vbAccelerator - Contents of code file: ClipNotifierVB_frmClipboardChangeDemo.vbPublic Class frmClipboardChangeDemo
Inherits System.Windows.Forms.Form
Private WithEvents clipChange As
vbAccelerator.Components.Win32.ClipboardChangeNotifier
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents lblAvailableFormats As System.Windows.Forms.Label
Friend WithEvents lstContents As System.Windows.Forms.ListBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmClipboardChangeDemo))
Me.lblAvailableFormats = New System.Windows.Forms.Label()
Me.lstContents = New System.Windows.Forms.ListBox()
Me.SuspendLayout()
'
'lblAvailableFormats
'
Me.lblAvailableFormats.Location = New System.Drawing.Point(8, 4)
Me.lblAvailableFormats.Name = "lblAvailableFormats"
Me.lblAvailableFormats.Size = New System.Drawing.Size(276, 20)
Me.lblAvailableFormats.TabIndex = 3
Me.lblAvailableFormats.Text = "Available Clipboard Formats:"
'
'lstContents
'
Me.lstContents.Location = New System.Drawing.Point(8, 28)
Me.lstContents.Name = "lstContents"
Me.lstContents.Size = New System.Drawing.Size(276, 225)
Me.lstContents.TabIndex = 2
'
'frmClipboardChangeDemo
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.AddRange(New System.Windows.Forms.Control()
{Me.lblAvailableFormats, Me.lstContents})
Me.Font = New System.Drawing.Font("Tahoma", 8.25!,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmClipboardChangeDemo"
Me.Text = "vbAccelerator Clipboard Change Notification"
Me.ResumeLayout(False)
End Sub
#End Region
' * This is a way of ensuring that you're always installed
' * even when the handle changes.
'protected overloads sub OnHandleCreated(byval EventArgs e)
' MyBase.OnHandleCreated(e)
' If Not (clipChange Is Nothing) Then
' clipChange.AssignHandle(Handle)
' clipChange.Install()
' End If
'End Sub
Private Sub showFormats()
lstContents.Items.Clear()
lstContents.Items.Add("Clipboard Changed at " + DateTime.Now)
Dim dto As IDataObject = Clipboard.GetDataObject()
Dim fmt As String
For Each fmt In dto.GetFormats()
lstContents.Items.Add(fmt)
Next
End Sub
Private Sub frmClipboardChangeDemo_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
clipChange = New
vbAccelerator.Components.Win32.ClipboardChangeNotifier()
clipChange.AssignHandle(Handle)
clipChange.Install()
End Sub
Private Sub clipChange_ClipboardChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles clipChange.ClipboardChanged
Application.DoEvents()
showFormats()
End Sub
End Class
|
|