2 스플리터가있는 폼이 있습니다. 하나의 스플리터는 양식을 수평으로 2 개의 열로 나눕니다. 다른 하나는 왼쪽 열을 2 행으로 나눕니다.Treeview 및 분할 컨트롤을 사용하여 Winforms 끌어서 놓기 구현
왼쪽 열에는 상단 "행"에 트리 뷰가 있습니다. 오른쪽 열에는 이미지 뷰어가 있습니다.
트리 뷰 노드를 이미지 뷰어에 놓고 그 노드로 무언가를하고 싶습니다.
뷰어를 "뷰어"라고합니다. (즉, 어떤 I는 트 리뷰 노드를 잡아 끌어 시작할 때마다, 그것은 바로 "아니오"아이콘이 표시,
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;
}
을하지만 : 트 리뷰는 다음과 같이
코드는 "EntityTreeView"라고합니다 흡연 기호 .. 뭐라 부르는 것이 든 슬래시가있는 원).
내가 뭘 잘못하고 있는지 아는 사람이 있습니까?
미리 도움을 청하십시오.
모든 관련 컨트롤에 대해 AllowDrop 속성을 true로 설정 했습니까? – NascarEd