2019-09-19 16:20:09 +02:00

66 lines
2.4 KiB
VB.net

Imports DigitalData.Modules.Windows
Imports DigitalData.Modules.Windows.Window
Public Class frmControlCapture
Public Property TopLeft As RectangleInfo
Public Property TopRight As RectangleInfo
Public Property BottomLeft As RectangleInfo
Public Property BottomRight As RectangleInfo
Private WithEvents Watcher As ClipboardWatcher = ClipboardWatcher.Singleton
Private Window As Window
Private Sub frmControlCapture_Load(sender As Object, e As EventArgs) Handles Me.Load
Window = New Window(LogConfig)
AddHandler Watcher.Changed, AddressOf Watcher_Changed
End Sub
Private Sub Watcher_Changed(sender As Object, e As EventArgs)
For Each oAnchor As Anchor In [Enum].GetValues(GetType(Anchor))
Dim oRect = Window.GetFocusedControlLocation(Handle, oAnchor)
Select Case oAnchor
Case Window.Anchor.TopLeft
If oRect IsNot Nothing Then
TopLeft = oRect
txtTLLeft.Text = oRect.Left
txtTLRight.Text = oRect.Right
txtTLTop.Text = oRect.Top
txtTLBottom.Text = oRect.Bottom
End If
Case Window.Anchor.TopRight
If oRect IsNot Nothing Then
TopRight = oRect
txtTRLeft.Text = oRect.Left
txtTRRight.Text = oRect.Right
txtTRTop.Text = oRect.Top
txtTRBottom.Text = oRect.Bottom
End If
Case Window.Anchor.BottomLeft
If oRect IsNot Nothing Then
BottomLeft = oRect
txtBLLeft.Text = oRect.Left
txtBLRight.Text = oRect.Right
txtBLTop.Text = oRect.Top
txtBLBottom.Text = oRect.Bottom
End If
Case Window.Anchor.BottomRight
If oRect IsNot Nothing Then
BottomRight = oRect
txtBRLeft.Text = oRect.Left
txtBRRight.Text = oRect.Right
txtBRTop.Text = oRect.Top
txtBRBottom.Text = oRect.Bottom
End If
End Select
Next
End Sub
End Class