本帖最后由 lxcnn 于 2008-10-09 00:12:35 编辑

解决方案 »

  1.   

    不知道datagridview控件能不能做出来
    我现在一直在用一个第三方控件,别的公司开发的
    具体什么名字不记得了,你在网上搜搜吧
      

  2.   

    做过grid拖拽方法的东西。。
    不知道楼主的要求是什么,我没看明白,请说清楚一点
      

  3.   

    下面的代码示例演示在两个 ListBox 控件之间的拖放操作。当拖动动作启动时,该示例调用 DoDragDrop 方法。在 MouseDown 事件期间,如果从鼠标位置起鼠标移动的距离大于 SystemInformation.DragSize,则启动拖动动作。IndexFromPoint 方法用于在 MouseDown 事件期间确定要拖动的项的索引。该示例同时演示了对拖放操作使用自定义光标。该示例要求应用程序目录中存在两个光标文件:3dwarro.cur 和 3dwno.cur,分别用于自定义拖动光标和禁止停放光标。如果选中 UseCustomCursorsCheckCheckBox,则使用自定义光标。自定义光标在 GiveFeedback 事件处理程序中设置。键盘状态在右 ListBox 的 DragOver 事件处理程序中计算,以确定基于 Shift、Ctrl、Alt 或 Ctrl+Alt 键的状态将发生哪种拖动操作。放置动作在 ListBox 中发生的位置也在 DragOver 事件期间确定。如果要放置的数据不是 String,则 DragDropEffects 中将把 DragEventArgs.Effect 设置为 None。最后,停放状态在 DropLocationLabelLabel 中显示。要放置的用于右 ListBox 的数据在 DragDrop 事件处理程序中确定,并且在 ListBox 中的适当位置添加该 String 值。如果拖动操作移动到窗体边框的外面,则 QueryContinueDrag 事件处理程序中将取消拖放操作。
      

  4.   

    下面的代码示例演示如何使用 DragDropEffects 枚举指定数据应如何在拖放操作中涉及到的控件之间进行传送。此示例要求您的窗体中包括一个 RichTextBox 控件和一个 Label 控件,并且 Label 控件用有效文件名列表进行填充。当用户将文件名拖到 RichTextBox 控件上时,该控件的 DragEnter 事件被引发。在事件处理程序中,DragEventArgs 的 Effect 属性被初始化为 DragDropEffects,以便指示该文件路径所引用的数据应复制到 RichTextBox 控件中。private void Form1_Load(object sender, EventArgs e) 
    {
       // Sets the AllowDrop property so that data can be dragged onto the control.
       richTextBox1.AllowDrop = true;   // Add code here to populate the ListBox1 with paths to text files.}private void listBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
       // Determines which item was selected.
       ListBox lb =( (ListBox)sender);
       Point pt = new Point(e.X,e.Y);
       int index = lb.IndexFromPoint(pt);   // Starts a drag-and-drop operation with that item.
       if(index>=0) 
       {
          lb.DoDragDrop(lb.Items[index].ToString(), DragDropEffects.Link);
       }
    }private void richTextBox1_DragEnter(object sender, DragEventArgs e) 
    {
       // If the data is text, copy the data to the RichTextBox control.
       if(e.Data.GetDataPresent("Text"))
          e.Effect = DragDropEffects.Copy;
    }private void richTextBox1_DragDrop(object sender, DragEventArgs e) 
    {
       // Loads the file into the control. 
       richTextBox1.LoadFile((String)e.Data.GetData("Text"), System.Windows.Forms.RichTextBoxStreamType.RichText);
    }