以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 不使用API移动无边框窗体,如何实现鼠标左键没有松开前显示虚框? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=82573) |
-- 作者:458445945 -- 发布时间:2016/3/21 0:07:00 -- 不使用API移动无边框窗体,如何实现鼠标左键没有松开前显示虚框? 以下是我目前用的代码 myform,zbx,zby是全局变量 自定义函数ydchuank1 Dim x As Integer = System.Windows.Forms.Cursor.Current.Position.X Dim y As Integer = System.Windows.Forms.Cursor.Current.Position.Y zbx = myform.left - x zby = myform.Top - y 自定义函数ydchuank2 Dim x As Integer = zbx + System.Windows.Forms.Cursor.Current.Position.X Dim y As Integer = zby + System.Windows.Forms.Cursor.Current.Position.Y myform.Left = x myform.Top = y myform.Width = myform.Width myform.Height = myform.Height mousemove事件 If e.Button = Windows.Forms.MouseButtons.Left And basemainform.WindowState <> Windows.Forms.FormWindowState.Maximized Then Functions.Execute("ydchuank2") End If mousedown事件 If e.Button = Windows.Forms.MouseButtons.Left And basemainform.WindowState <> Windows.Forms.FormWindowState.Maximized Then myform = basemainform Functions.Execute("ydchuank1") End If |
-- 作者:大红袍 -- 发布时间:2016/3/21 2:45:00 -- 不行,不用api,就不能捕捉到鼠标移动弹起的消息,也就无法做虚框的效果。 |
-- 作者:458445945 -- 发布时间:2016/3/21 10:01:00 -- 嗯嗯 好的 谢谢老师! |