有很多軟件為了實現特殊的顯示效果
方法一
這種方法是在窗體的MouseDown
進入VB
PrivateTypePOINT
XAsSingle
YAsSingle
EndType
DimFormPAsPOINT
DimMousePAsPOINT
DimMouseLButtonDownAsBoolean
PrivateSubCommand
End
EndSub
PrivateSubForm_MouseDown(ButtonAsInteger
FormP
FormP
MouseP
MouseP
IfButton=
MouseLButtonDown=True
EndIf
EndSub
PrivateSubForm_MouseMove(ButtonAsInteger
IfMouseLButtonDownThen
Form
Form
EndIf
EndSub
PrivateSubForm_MouseUp(ButtonAsInteger
MouseLButtonDown=False
EndSub
上述方法不是很完善
方法二
這種方法通過消息的發送實現移動無標題窗體
PrivateDeclareFunctionReleaseCaptureLib
PrivateDeclareFunctionSendMessageLib
ByValwMsgAsLong
PrivateConstWM_NCLBUTTONDOWN=&&HA
PrivateConstHTCAPTION=
PrivateSubForm_MouseDown(ButtonAsInteger
IfButton=
CallReleaseCapture
CallSendMessage(hwnd
EndIf
EndSub
PrivateSubCommand
End
EndSub
這種方法實現起來比第一種方法更容易
以上程序在VB
From:http://tw.wingwit.com/Article/program/net/201311/15590.html