I have this System.Windows.Forms.Panel that I want to enable so that if the user click and drags the mouse drags the window around to.
Can I do this? Do i have to implem
Currently Set For A Panel. VS C# Just Messing About Seems to work for me as I wanted Sets application left-top corner to mouse position while left-click is pressed.
public form1()
{
InitializeComponent();
this.panel2.MouseMove += new MouseEventHandler(panel2_MouseMove);
}
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
private void panel2_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point loc1 = MousePosition;
this.Location = loc1;
}
}