关于TreeView的拖动排序问题??????????????
我用以下代码实现TreeView的拖动问题
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace TreeViewTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Point Position = new Point(0, 0);
private void Form1_Load(object sender, EventArgs e)
{
this.tvwTest.ExpandAll();
}
private void tvwTest_ItemDrag(object sender, ItemDragEventArgs e)
{
DoDragDrop(e.Item, DragDropEffects.Move);
}
private void tvwTest_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(TreeNode)))
e.Effect = DragDropEffects.Move;
else
e.Effect = DragDropEffects.None;
}
private void tvwTest_DragDrop(object sender, DragEventArgs e)
{
TreeNode myNode = null;
if (e.Data.GetDataPresent(typeof(TreeNode)))
{
myNode = (TreeNode)(e.Data.GetData(typeof(TreeNode)));
}
&