Example #1
0
        public FileBrowser(string title, string ext = "", FilterType filterType = null, Icon icon = null, FilterType selectableType = null)
        {
            if (null == filterType)
            {
                filterType = FilterType.ANY;
            }

            InitializeComponent();

            try
            {
                this.Text  = title;
                Ext        = ext;
                FilterType = filterType;
                if (selectableType == null)
                {
                    SelectableType = FilterType.DIR;
                }
                else
                {
                    SelectableType = selectableType;
                }
                if (icon != null)
                {
                    this.Icon = icon;
                }

                // 初始化ImageList
                imgLst.Images.AddRange(FileBrowserImg.GetAllImgs().ToArray());
                tvFile.ImageList = imgLst;

                InitEvent();
            }
            catch (Exception ex)
            {
                Logger.WriteEx2LogFile(ex);
            }
        }