首先呢,要对拖放到控件中的数据进行判断

        private void textBox1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
        
{
            
if(e.Data.GetDataPresent(DataFormats.FileDrop))
            
{
                e.Effect
=DragDropEffects.Link;
                
            }

            
else
                e.Effect
=DragDropEffects.None;
            
        }

然后在DragDrop事件中进行操作
private void textBox1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        
{


            textBox1.Text
=((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
            
        }

posted on 2005-02-06 21:34  AoingLOG  阅读(553)  评论(0编辑  收藏  举报