Custom form designer, move/resize controls using WinAPI
Posted
by jonny
on Stack Overflow
See other posts from Stack Overflow
or by jonny
Published on 2009-04-18T10:15:40Z
Indexed on
2010/03/20
21:41 UTC
Read the original article
Hit count: 801
I have to fix some problems and enchance form designer written long ago for a database project. In Design Panel class code I encountered these lines
private void DesignPanel_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
(sender as Control).Capture = false;
switch (FMousePosition)
{
case MousePosition.mpNone:
SendMessage((sender as Control).Handle, WM_SYSCOMMAND, 0xF009, 0);
break;// Move
case MousePosition.mpRightBottom:
SendMessage((sender as Control).Handle, WM_SYSCOMMAND, 0xF008, 0);
break;//RB
case MousePosition.mpLeftBottom:
SendMessage((sender as Control).Handle, WM_SYSCOMMAND, 0xF007, 0);
// ... here are similar cases ...
case MousePosition.mpLeft:
SendMessage((sender as Control).Handle, WM_SYSCOMMAND, 0xF001, 0);
break;//L
}
}
}
FMousePosition indicates whether mouse was over any edge of selected control.
What confusing me is these windows messages: it seems there is no documentation on WM_SYSCOMMAND with parameters 0xF001-0xF009 (maybe it starts some kind of 'drag/resize sequence'). Any ideas?
If my suggestion is right, then how can I cancel these sequences?
© Stack Overflow or respective owner