zoukankan      html  css  js  c++  java
  • C# 文件拖放

    将控件的属性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);
                }
            }
  • 相关阅读:
    购物车宣传页
    项目开发流程
    AJAX跨域
    jQuery中的AJAX
    AJAX封装
    AJAX里使用模板引擎
    AJAX的具体使用
    AJAX的基本使用
    js技巧汇总
    CSS特效汇集
  • 原文地址:https://www.cnblogs.com/ike_li/p/7505532.html
Copyright © 2011-2022 走看看