Exemple #1
0
        bool IsCut = false; // if cutting file

        public MainForm()
        {
            InitializeComponent();
            InfoTextBox.Hide();
            fileView.AllowDrop = true;

            fileView.View           = View.Details;
            fileView.SmallImageList = new ImageList();
            fileView.LargeImageList = new ImageList();

            fileView.Columns.Add("Name", 150, HorizontalAlignment.Left);
            fileView.Columns.Add("Creation Date", 100, HorizontalAlignment.Center);
            fileView.Columns.Add("Size", 120, HorizontalAlignment.Center);

            imglist.Images.Add(Bitmap.FromFile("CLSDFOLD.ICO"));
            imglist.Images.Add(Bitmap.FromFile("OPENFOLD.ICO"));
            imglist.Images.Add(Bitmap.FromFile("Drive01.ico"));
            treeView1.ImageList = imglist;

            string[] drives = Directory.GetLogicalDrives();
            foreach (string drive in drives)
            {
                TreeNode node = new TreeNode(drive, 2, 2);
                treeView1.Nodes.Add(node);
                FillByDirectories(node);
            } // foreach
        }
Exemple #2
0
        } // treeView1_AfterSelect

        private void fileView_MouseClick(object sender, MouseEventArgs e)
        {
            if (fileView.SelectedItems.Count == 0)
            {
                return;
            }
            currentFile = currentPath + "\\" + fileView.SelectedItems[0].Text;
            string ext = Path.GetExtension(currentFile).ToLower();

            if (Directory.Exists(currentFile) || new FileInfo(currentFile).Length == 0)
            {
                return;
            }

            if ((ext == ".jpg") || (ext == ".png") || (ext == ".bmp") || (ext == ".gif"))
            {
                InfoPictureBox.Image = new Bitmap(currentFile);
                InfoPictureBox.Show();
                InfoTextBox.Hide();
            }
            else if (ext == ".txt")
            {
                InfoTextBox.Text = File.ReadAllLines(currentFile).First();
                InfoTextBox.Show();
                InfoPictureBox.Hide();
            }
            else
            {
                InfoPictureBox.Hide();
                InfoTextBox.Hide();
            }
        } // fileView_MouseClick