Foxtable(狐表)用户栏目专家坐堂 → 请问如何实现无边框窗口鼠标移动?(已解决)


  共有12453人关注过本帖树形打印复制链接

主题:请问如何实现无边框窗口鼠标移动?(已解决)

帅哥哟,离线,有人找我吗?
程兴刚
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:超级版主 帖子:7258 积分:40773 威望:0 精华:16 注册:2008/8/31 23:23:00
  发帖心情 Post By:2012/3/26 21:50:00 [显示全部帖子]

得到楼主的代码,效果很不错,搜索本论坛,没有搜索到类似的代码,在这里共享一下:

 

全局代码:

 

Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer,ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Integer) As Integer
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Public Sub Panel_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs)
If e.Button=MouseButtons.Left Then
    ReleaseCapture()
    SendMessage(sender.Parent.Handle.ToInt32, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
End Sub

 

 

AfterLoad 事件代码:

 

e.form.BaseForm.FormBorderStyle = Windows.Forms.FormBorderStyle.None
AddHandler e.Form.Panel.MouseDown,AddressOf Panel_MouseDown

[此贴子已经被作者于2012-3-26 22:22:20编辑过]

 回到顶部