PasteSite.Com

Recent Pastes

Sign Up!

PasteSite is open to the public, but with limited features. Register to be able to modify access rights, track your pastes and more...

Change the theme

If you prefer reading light text on a dark background to dark text on a light background, then you might want to try the dark theme.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Public Class Form1
    Public regionPen As Pen
    Dim pX, pY, nX, nY, rHei, rWid, rTop, rLeft As Integer
    Dim grabRegion As Rectangle
    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            pX = e.Location.X
            pY = e.Location.Y
            Me.Refresh()
        End If
    End Sub
    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        Dim Graphics As System.Drawing.Graphics = Graphics.FromHwnd(Me.Handle)
        Me.Refresh()
        regionPen = New Pen(Color.SteelBlue, 1)
        regionPen.DashStyle = Drawing2D.DashStyle.Solid
        With grabRegion
            If pX > e.X Then .Width = pX - e.X Else .Width = e.X - pX
            If pY > e.Y Then .Height = pY - e.Y Else .Height = e.Y - pY
            If pY > e.Y Then .Y = e.Y Else .Y = pY
            If pX > e.X Then .X = e.X Else .X = pX
        End With
        Graphics.DrawRectangle(Pens.SteelBlue, grabRegion)
    End Sub
    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        Me.Refresh()
    End Sub
End Class

Reply to This Paste

(leave blank to make this paste permanent)
(if set as private)