Bootstrap

c#窗体事件

  从网上看到了一个窗体拖动事件,超级简洁,至少现在这个阶段我是看起来有困难的 有兴趣的哥们们可以讨论下 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication2 { public partial class Form1 : Form { private const int WM_NCHITTEST = 0x84;//这几行真够晕的,貌似调用了基本函数饿 private const int HTCLIENT = 0x1; private const int HTCAPTION = 0x2; public Form1() { InitializeComponent(); } protected override void WndProc(ref Message m) { switch (m.Msg) { case WM_NCHITTEST: base.WndProc(ref m); if ((int)m.Result == HTCLIENT) m.Result = (IntPtr)HTCAPTION; return; break; } base.WndProc(ref m); } } } 我试过了,可以运行,就是貌似最后那个break有点问题,看不懂...嘿嘿 还得继续努力啊!
;