VB.NET中如何防止FORM被移动呀?

来源:百度知道 编辑:UC知道 时间:2024/04/30 03:52:58
在VB6中FORM的属性里就有MOVABLE,将他设成False就行了,可是在VB.NET的FORM的属性里没有MOVABLE这个属性呀?要怎么办呀?谢谢了

不知道有什么办法,有点郁闷,下面的代码运行不稳定,给你点思路吧。
Dim FormPoint As Point
Public Const WM_MOVE = &H3

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.FormPoint = New Point(Me.Left, Me.Top)
End Sub

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = wm_move Then
Me.Location = FormPoint
Else
MyBase.WndProc(m)
End If
End Sub