Winform无边框拖动
设置无边框 Form:
public Customize() { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.None; }
通过重写 WndProc 实现无边框窗体的拖动:
private const int WM_NCHITTEST = 0x84;
private const int HTCLIENT = 0x1;
private const int HTCAPTION = 0x2;
// Implement the drag of the form
protected override void WndProc(ref Message message)
{
base.WndProc(ref message);
if (message.Msg == WM_NCHITTEST && (int)message.Result == HTCLIENT)
{
message.Result = (IntPtr)HTCAPTION;
}
}
把圈子变小,把语言变干净,把成绩往上提,把故事往心里收,现在想要的以后你都会有。

浙公网安备 33010602011771号