Hack Forums
[.NET] Region Capture Control {Form} - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Region Capture Control {Form} (/showthread.php?tid=4553121)



Region Capture Control {Form} - Only3 - Nov 24, 2014

i guess many have use for this

[Image: 8OPrhdd.png]

http://pastebin.com/HV30Cavq

🤝


* - AEDEAD - Nov 24, 2014

Fuck ur code.

Code
Private MyRectangle As Rectangle
    Private Drawing As Boolean = False
    Private StartX, StartY, CursorX, CursorY As Single
    Private Sub Region_Drag_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
      If Drawing = True Then
      Dim Oral_Pen As New Pen(Brushes.Red, 2) 'Color and Size
      Oral_Pen.DashStyle = Drawing2D.DashStyle.Solid 'Pattern
      MyRectangle = New Rectangle(Min(StartX, CursorX), _
      Min(StartY, CursorY), _
      Abs(StartX - CursorX), _
      Abs(StartY - CursorY))
      e.Graphics.FillRectangle(New SolidBrush(Color.Transparent), MyRectangle)
      e.Graphics.DrawRectangle(Oral_Pen, MyRectangle)
      End If
    End Sub
    Private Sub Region_Drag_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
      If e.KeyCode = Keys.Escape Then
      Application.Exit()  'escape from expectations
      End If
    End Sub
    Private Sub Region_Drag_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
      Me.BackColor = Color.Fuchsia 'or this
      Me.Opacity = 100% 'Dont need this
      Drawing = True
      StartX = e.X
      StartY = e.Y
      CursorX = e.X
      CursorY = e.Y
    End Sub
    Private Sub Region_Drag_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
      If Not Drawing Then Exit Sub
      Dim G As Graphics = Me.CreateGraphics
      CursorX = e.X
      CursorY = e.Y
      Me.Invalidate()
    End Sub
    Private Sub Region_Drag_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
      Drawing = False
      Dim G As Graphics = Me.CreateGraphics
      G.DrawRectangle(Pens.Black, MyRectangle.X, MyRectangle.Y, MyRectangle.Width, MyRectangle.Height)

      Me.Invalidate()
      Me.Dispose()
    End Sub
    Private Sub Region_Drag_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Me.Focus()
      Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
      Me.TopMost = True
      Me.Location = New Point(0, 0)
      Me.Size = Screen.PrimaryScreen.Bounds.Size
      Me.DoubleBuffered = True
    End Sub

Mine is easier to understand and more copy pastable for noobs.


* - Only3 - Nov 25, 2014

the only1 that reply was this dumb 😊


* - Hawk HF - Nov 26, 2014

(Nov 24, 2014 02:17 PM)AEDEAD Wrote:  Mine is easier to understand and more copy pastable for noobs.

Let's not brag about how skiddable our code is.


* - SIM-1456245 - Nov 26, 2014

Good that you changed the avatar, but bad that you are using VB6 funcs.


* - Only3 - Nov 26, 2014

(Nov 26, 2014 03:04 PM)Electroalek Wrote:  Good that you changed the avatar, but bad that you are using VB6 funcs.

i use Environ cuz its short and im lazy