移动无边框窗口问题

请问如何在VB中移动无边框窗体?... 请问如何在VB中移动无边框窗体? 展开
 我来答
mosquitokobe
2009-05-17 · TA获得超过4253个赞
知道大有可为答主
回答量:5008
采纳率:50%
帮助的人:0
展开全部
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SetWindowPos Lib "user32.dll" (ByVal lhwnd As Long, ByVal hWndInsertAfter As Long, ByVal swpX As Long, ByVal swpY As Long, ByVal cX As Long, ByVal cY As Long, ByVal wFlags As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim lngReturnValue As Long
If Button = 1 Then
Call ReleaseCapture
lngReturnValue = SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If
If Me.Left >= Screen.Width - (Me.Width * 0.9) Then
Me.Left = Screen.Width - Me.Width
Else
If Me.Left <= -(Me.Width * 0.1) Then
Me.Left = 0
End If
End If
If Me.Top >= Screen.Height - (Me.Height * 0.9) Then
Me.Top = Screen.Height - Me.Height
Else
If Me.Top <= -(Me.Height * 0.1) Then
Me.Top = 0
End If
End If
End Sub
百度网友e9042513a
2009-05-17 · TA获得超过6984个赞
知道大有可为答主
回答量:2388
采纳率:0%
帮助的人:3504万
展开全部
Private Const WM_NCLBUTTONDOWN = &HA1
Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
Private Declare Function ReleaseCapture Lib "user32" () As Long

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage hwnd, WM_NCLBUTTONDOWN, 2, 0

End Sub

这样就可以了
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
lxz1969
2009-05-17 · TA获得超过1.1万个赞
知道大有可为答主
回答量:8524
采纳率:33%
帮助的人:1.1亿
展开全部
只有用代码移动了。
form1.move 坐标值
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式