Simple Message question...

  • Thread starter Thread starter craig.kelly
  • Start date Start date
C

craig.kelly

I'm experimenting with the message object in C#. If I try to move the
window by clicking on the client area, why does this work:

private void baseForm_MouseDown(object sender, MouseEventArgs e)
{
Capture = false;
Message message = Message.Create(Handle, 161, (IntPtr)2, IntPtr.Zero);
WndProc(ref message);
}

but if I do the same thing from an object on the form:

private void label1_MouseDown(object sender, MouseEventArgs e)
{
Capture = false;
Message message = Message.Create(Handle, 161, (IntPtr)2, IntPtr.Zero);
WndProc(ref message);
}

it doesn't work?
 
Hi Craig,

I think it would be easier to override WndProc, handle WM_NCHITTEST and once
the pointer is over the label, return HTCAPTION in response to WM_NCHITTEST.
 
Back
Top