Esempio n. 1
0
        void label_Click(object sender, EventArgs e)
        {
            FolderLabel label = (FolderLabel)sender;

            label.BackColor = Color.LightBlue;
            if (selected != null)
            {
                selected.BackColor = Color.Transparent;
            }
            this.selected = label;
            OnSelectionChanged(this, null);
        }
Esempio n. 2
0
        private void PaintDirectory(string dir, bool drawImg, int tab = 0)
        {
            FolderLabel label = new FolderLabel(dir);

            this.Controls.Add(label);
            label.Text   = dir.Substring(dir.LastIndexOf("\\"));
            label.Top    = height;
            label.Width  = this.Width - tab;
            label.Left   = tab + 16;
            label.Click += label_Click;
            if (selected != null && selected.Directory == dir)
            {
                selected           = label;
                selected.BackColor = Color.LightBlue;
            }

            if (Directory.GetDirectories(dir, "*", SearchOption.TopDirectoryOnly).Length > 0 && drawImg)
            {
                FolderPictureBox pbox = new FolderPictureBox(dir);
                this.Controls.Add(pbox);
                if (openDirectories.Contains(dir))
                {
                    pbox.BackgroundImage = Image.FromFile("Editor\\Standard\\Img\\Open.png");
                }
                else
                {
                    pbox.BackgroundImage = Image.FromFile("Editor\\Standard\\Img\\Closed.png");
                }
                pbox.Left   = tab;
                pbox.Top    = height;
                pbox.Width  = pbox.BackgroundImage.Width;
                pbox.Height = pbox.BackgroundImage.Height;

                pbox.Click += pbox_Click;
            }

            height += label.Height;

            if (openDirectories.Contains(dir))
            {
                foreach (string dir2 in Directory.GetDirectories(dir, "*", SearchOption.TopDirectoryOnly))
                {
                    PaintDirectory(dir2, drawImg, tab + 16);
                }
            }
        }