|
'//Written by KEN (Minjian Huang).
'//(c) 2007 Management strategies Ltd
'//http://www.ms-strategies.com/
Imports System.Drawing.Graphics
Public Class inVisibleCapWin
Dim start As Boolean = False
Dim startX, startY As Integer
Dim FromHotkey As Boolean
Dim drawRect As Rectangle
Sub PrepareCap(Optional ByVal isFromHotkey As Boolean = True)
FromHotkey = isFromHotkey
Me.Visible = True
Me.TopMost = True
Me.Activate()
End Sub
Sub FinishCap()
Me.TopMost = False
Me.Visible = False
Me.Close()
If Not FromHotkey Then Main.waitForCapFinished()
End Sub
Private Sub inVisibleCapWin_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
start = True
Dim CursorPos As New Point
CursorPos = Cursor.Position()
startX = CursorPos.X
startY = CursorPos.Y
Debug.Print("start: " & startX & "," & startY)
End Sub
Private Sub inVisibleCapWin_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If start Then
Dim CursorPos As New Point
CursorPos = Cursor.Position()
drawRect = makeRectangle(startX, startY, CursorPos.X, CursorPos.Y)
'clear the screen
Me.Invalidate(New Rectangle(0, 0, Me.Width, Me.Height))
'draw the rectangle
Me.Invalidate(drawRect)
Debug.Print(CursorPos.X & "," & CursorPos.Y)
End If
End Sub
Private Sub inVisibleCapWin_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
start = False
FinishCap()
Dim Filename As String
Filename = makeup_Filename(Scr_num, Dir_Path, Prefix_fn, Subfix_fn)
imgRect = drawRect
Debug.Print("draw at (" & imgRect.X & "," & imgRect.Y & ") (" & imgRect.Width & "x" & imgRect.Height & ")")
Main.Cap_screen(Filename, Subfix_fn)
End Sub
Private Sub inVisibleCapWin_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim blackPen As New Pen(Color.Black, 2)
' Draw rectangle to screen.
e.Graphics.DrawRectangle(blackPen, drawRect)
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.