add new clipboard watcher class

This commit is contained in:
Jonathan Jenne
2019-10-22 16:08:33 +02:00
parent 42a3aad5e2
commit be7e314b32
5 changed files with 146 additions and 100 deletions

View File

@@ -7,10 +7,11 @@ Public Class frmControlCapture
Public Property BottomLeft As RectangleInfo
Public Property BottomRight As RectangleInfo
Public Property ControlName As String
Public Property ControlName As String = String.Empty
Public Property ControlBounds As String
Private WithEvents Watcher As ClipboardWatcher = ClipboardWatcher.Singleton
'Private WithEvents Watcher As ClipboardWatcher = ClipboardWatcher.Singleton
Private WithEvents Watcher2 As ClassClipboardWatcher = ClassClipboardWatcher.Singleton
Private Window As Window
Private EditMode As Boolean = False
@@ -41,10 +42,11 @@ Public Class frmControlCapture
txtControlBounds.Text = ControlBounds
End If
AddHandler Watcher.Changed, AddressOf Watcher_Changed
'AddHandler Watcher.Changed, AddressOf Watcher_Changed
AddHandler Watcher2.Changed, AddressOf Watcher_Changed
End Sub
Private Sub Watcher_Changed(sender As Object, e As EventArgs)
Private Sub Watcher_Changed(sender As Object, e As String)
Try
' === CONTROL NAME ===
Dim oControl As WindowInfo = Window.GetFocusedControl(Handle)
@@ -120,16 +122,20 @@ Public Class frmControlCapture
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles rbControlName.CheckedChanged
gbControlName.Enabled = rbControlName.Checked
gbControlPosition.Enabled = Not rbControlName.Checked
txtControlName.Enabled = rbControlName.Checked
txtControlBounds.Enabled = Not rbControlName.Checked
btnOK.Enabled = rbControlName.Checked And ControlName <> String.Empty
End Sub
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles rbControlPosition.CheckedChanged
gbControlName.Enabled = Not rbControlPosition.Checked
gbControlPosition.Enabled = rbControlPosition.Checked
txtControlBounds.Enabled = rbControlPosition.Checked
txtControlName.Enabled = Not rbControlPosition.Checked
btnOK.Enabled = rbControlPosition.Checked And TopLeft IsNot Nothing
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnOK.Click
If txtControlName.Text = String.Empty And txtControlBounds.Text = String.Empty Then
MsgBox("Kein Control gefunden!")
DialogResult = DialogResult.Cancel