I have a form that has 2 splitters. One splitter splits the form horizonally into 2 columns. The other splits the left column into 2 rows.
On the left hand column, top "row" I have a treeview. On the right hand column, I have a image viewer.
I want to drop a treeview node onto the image viewer and do something with it.
The viewer is called "viewer". The treeview is called "EntityTreeView"
The code is as follows:
private void viewer_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Move;
}
private void viewer_DragDrop(object sender, DragEventArgs e)
{
TreeNode droppedNode;
droppedNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
MessageBox.Show(String.Format("You dropped a node with text: {0}\n on the viewer at X:{1} Y:{2}", droppedNode.Text, e.X, e.Y), "Drag Drop Finished", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void EntityTreeView_ItemDrag(object sender, ItemDragEventArgs e)
{
DoDragDrop(e.Item, DragDropEffects.Move);
}
private void EntityTreeView_DragDrop(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Move;
}
private void EntityTreeView_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.None;
}
However, whenever I grab a treeview node and start dragging it, it immediately shows the "No" icon (i.e., the no smoking sign.. circle with a slash, whatever that's called).
Any idea what I'm doing wrong?
Thanks in advance for any help.