我必须解决一些问题并增强很久以前为数据库项目编写的表单设计器。在设计面板类代码中,我遇到了这些行
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 指示鼠标是否在选定控件的任何边缘上。
令我困惑的是这些 Windows 消息:似乎没有关于 WM_SYSCOMMAND 参数为 0xF001-0xF009 的文档(也许它启动了某种“拖动/调整大小序列”)。有任何想法吗?
如果我的建议是正确的,那么我该如何取消这些序列?