C#获取文件目录

2021-09-16 12:12

阅读:699

标签:base   log   default   object   程序   public   入口   cal   etc   Form1.csusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace FileCatalog{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private void Form1_DragEnter(object sender, DragEventArgs e)        {            e.Effect = DragDropEffects.Copy;                            //设置拖放操作中目标放置类型为复制            String[] str_Drop = (String[])e.Data.GetData(DataFormats.FileDrop, true);//检索数据格式相关联的数据            MessageBox.Show(str_Drop[0]);        }    }}Form1.Designer.csnamespace FileCatalog{    partial class Form1    {        ///         /// 必需的设计器变量。        ///         private System.ComponentModel.IContainer components = null;        ///         /// 清理所有正在使用的资源。        ///         /// 如果应释放托管资源,为 true;否则为 false。        protected override void Dispose(bool disposing)        {            if (disposing && (components != null))            {                components.Dispose();            }            base.Dispose(disposing);        }        #region Windows 窗体设计器生成的代码        ///         /// 设计器支持所需的方法 - 不要        /// 使用代码编辑器修改此方法的内容。        ///         private void InitializeComponent()        {            this.SuspendLayout();            //             // Form1            //             this.AllowDrop = true;            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;            this.ClientSize = new System.Drawing.Size(292, 99);            this.Name = "Form1";            this.Text = "获取文件目录";            this.DragEnter += new System.Windows.Forms.DragEventHandler(this.Form1_DragEnter);            this.ResumeLayout(false);        }        #endregion    }}Program.csusing System;using System.Collections.Generic;using System.Linq;using System.Windows.Forms;namespace FileCatalog{    static class Program    {        ///         /// 应用程序的主入口点。        ///         [STAThread]        static void Main()        {            Application.EnableVisualStyles();            Application.SetCompatibleTextRenderingDefault(false);            Application.Run(new Form1());        }    }}C#获取文件目录标签:base   log   default   object   程序   public   入口   cal   etc   原文地址:http://www.cnblogs.com/cddaishi/p/7423456.html


评论


亲,登录后才可以留言!