之前看到过一个CSDN上的教程,移动无标题窗体很麻烦很麻烦,要不断重画窗体。
使用这种FormBorderStyle设置为none的窗体,可以简单的实现自定义窗体皮肤,当然皮肤要自己做图片了。

今天无意间发现了一个很简单的代码,调用了系统API
在Program.cs中存在如下代码:

移动无标题(边框)窗体        [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 frmInputPsd_MouseDown(object sender, MouseEventArgs e)
        }

相关文章: