using System.Windows.Forms; using System.Runtime.InteropServices;
//csc /t:winexe Form2.cs
//InitializeComponent();
this.MouseDown += f_MouseDown
; }
void f_MouseDown
(object sender, MouseEventArgs e
){ if (e
.Button == MouseButtons
.Left){ ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}
[DllImportAttribute("user32.dll")]
[DllImportAttribute("user32.dll")]
/*
protected override void WndProc(ref Message m){
switch (m.Msg){
case 0x84: //WM_NCHITTEST
base.WndProc(ref m);
if ((int)m.Result == 0x1) //HTCLIENT
m.Result = (IntPtr)0x2; //HTCAPTION
return;
}
base.WndProc(ref m);
}
*/
[STAThread]
Application
.Run(new Form2
()); }
}
}