标签:code 添加 处理 def last bst get ring indexof
将控件的属性AllowDrop设置为true,然后添加DragDrop、DragEnter时间处理函数
private void FormMain_DragEnter(object sender, DragEventArgs e) { if(e.Data.GetDataPresent(DataFormats.FileDrop)) { txtSourceBin.Text = ""; txtGenerateBin.Text = ""; e.Effect = DragDropEffects.Link; } else { e.Effect = DragDropEffects.None; } } private void FormMain_DragDrop(object sender, DragEventArgs e) { string filePath= ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString(); if (filePath.Substring(filePath.LastIndexOf(".")).ToLower() == ".bin") { txtSourceBin.Text = filePath; SetDefaultFileName(txtSourceBin.Text); } }
标签:code 添加 处理 def last bst get ring indexof
原文地址:http://www.cnblogs.com/ike_li/p/7505532.html