html515vb,VB.NET Application.AddMessageFilter方法代码示例

' 导入命名空间

Imports System.Drawing

Imports System.Drawing.Drawing2D

Imports System.Windows.Forms

Imports System.Math

public class MessageFilter

public Shared Sub Main

Application.Run(New Form1)

End Sub

End class

Public Class Form1

Public Class NoLeftDownMessageFilter

Implements IMessageFilter

Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean Implements IMessageFilter.PreFilterMessage

Const WM_LBUTTONDOWN As Long = &H201

Return (m.Msg = WM_LBUTTONDOWN)

End Function

End Class

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim no_left_down_message_filter As New NoLeftDownMessageFilter

Application.AddMessageFilter(no_left_down_message_filter)

End Sub

Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click

Application.UseWaitCursor = Not Application.UseWaitCursor

End Sub

End Class

_

Partial Public Class Form1

Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.

_

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing AndAlso components IsNot Nothing Then

components.Dispose()

End If

MyBase.Dispose(disposing)

End Sub

Private components As System.ComponentModel.IContainer

_

Private Sub InitializeComponent()

Me.SuspendLayout()

Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)

Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

Me.ClientSize = New System.Drawing.Size(292, 273)

Me.Text = "UseMessageFilter"

Me.ResumeLayout(False)

End Sub

End Class

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值