具体代码如下所示:
#region 无边框拖动效果 [dllimport("user32.dll")]//拖动无窗体的控件 public static extern bool releasecapture(); [dllimport("user32.dll")] public static extern bool sendmessage(intptr hwnd, int wmsg, int wparam, int lparam); public const int wm_syscommand = 0x0112; public const int sc_move = 0xf010; public const int htcaption = 0x0002; private void start_mousedown(object sender, mouseeventargs e) { //拖动窗体 releasecapture(); sendmessage(this.handle, wm_syscommand, sc_move + htcaption, 0); } #endregion
在窗口属性界面添加事件服务
总结
以上所述是小编给大家介绍的c# 实现窗口无边框,可拖动效果,希望对大家有所帮助
如对本文有疑问, 点击进行留言回复!!
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
网友评论