1
我正在尝试执行一个简单的拖放操作,从一个MDI子窗体中的一个按钮开始到另一个MDI子窗体中的另一个按钮。但由于某些原因,当我试图将一个按钮拖到另一个按钮时,DragDrop事件从未被触发。值得注意的是,当我拖动按钮时,我的光标变成黑色取消图标。在MDI子表单中拖动n个拖放操作
我的代码:
#region ActivatesDragDropControl
[DllImport ("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
private const int WM_NCACTIVATE = 0x0086;
#endregion
private void button1_MouseDown(object sender, MouseEventArgs e)
{
DoDragDrop(LocationNode, DragDropEffects.Link);
// to deactivate
SendMessage(Handle, WM_NCACTIVATE, 0, 0);
}
private void button1_DragDrop(object sender, DragEventArgs e)
{
//never gets here...
}
private void button1_DragEnter(object sender, DragEventArgs e)
{
// to activate
SendMessage(Handle, WM_NCACTIVATE, 1, 0);
}
这是什么语言? – 2010-11-26 10:48:52