كود :
Public Class Form1
'3booody
'vb4arb.com
Dim D As Boolean
Dim x, y As Short
Dim rec 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.Right Then Me.Close()
D = True
x = e.X : y = e.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
Cursor.Current = Cursors.Cross
If D Then
Invalidate()
If e.X < x Then
If e.Y < y Then
rec = New Rectangle(e.X, e.Y, x - e.X, y - e.Y)
Else
rec = New Rectangle(e.X, y, x - e.X, e.Y - y)
End If
Else
If e.Y < y Then
rec = New Rectangle(x, e.Y, e.X - x, y - e.Y)
Else
rec = New Rectangle(x, y, e.X - x, e.Y - y)
End If
End If
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
D = False
If x = e.X And y = e.Y Then Return
Me.Hide()
System.Threading.Thread.Sleep(999)
Try
Dim Bit As New Bitmap(rec.Width, rec.Height)
Dim Gr As Graphics = Graphics.FromImage(Bit)
Gr.CopyFromScreen(rec.X, rec.Y, 0, 0, New Size(rec.Width, rec.Height))
Dim save As New SaveFileDialog
save.FileName = "Image"
save.Filter = "JPEG|*.JPEG"
If save.ShowDialog = Windows.Forms.DialogResult.OK Then
Bit.Save(save.FileName)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Me.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TransparencyKey = Color.White
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Me.WindowState = FormWindowState.Maximized
Me.BackColor = Color.Black
Me.Opacity = 0.2
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
If D Then
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
e.Graphics.FillRectangle(Brushes.White, rec)
End If
End Sub
End Class