Esempio n. 1
0
        public TGCTextureModifier(string modifierName, string defaultPath) : this()
        {
            tgcModifierTitleBar.setModifierName(modifierName);
            tgcModifierTitleBar.setContentPanel(contentPanel);

            DefaultPath      = defaultPath;
            SelectedPath     = defaultPath;
            textureBox.Image = getImage(defaultPath);
            TextureBrowser   = new TgcTextureBrowser(defaultPath);
            TextureBrowser.setSelectedImage(defaultPath);
        }
            public ImageControl(string imageFile, TgcTextureBrowser textureBrowser, bool isDirectory)
            {
                filePath            = imageFile;
                this.textureBrowser = textureBrowser;
                this.isDirectory    = isDirectory;

                BorderStyle   = BorderStyle.FixedSingle;
                BackColor     = Color.White;
                AutoSize      = true;
                FlowDirection = FlowDirection.TopDown;
                Click        += ImageControl_Click;

                pictureBox              = new PictureBox();
                pictureBox.SizeMode     = PictureBoxSizeMode.Zoom;
                pictureBox.Click       += pictureBox_Click;
                pictureBox.DoubleClick += pictureBox_DoubleClick;

                //cargar imagen default para directorios
                if (this.isDirectory)
                {
                    pictureBox.Size  = new Size(128, 128);
                    pictureBox.Image = textureBrowser.pictureBoxDirIcon.Image;
                }
                //cargar imagen de archivo
                else
                {
                    pictureBox.Size  = new Size(128, 128);
                    pictureBox.Image = Image.FromFile(imageFile);
                }

                Controls.Add(pictureBox);

                filenameLabel          = new Label();
                filenameLabel.AutoSize = false;
                filenameLabel.Size     = new Size(pictureBox.Width, 20);
                if (isDirectory)
                {
                    filenameLabel.Font = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold);
                }
                var pathArray = imageFile.Split('\\');

                filenameLabel.Text      = pathArray[pathArray.Length - 1];
                filenameLabel.Click    += filenameLabel_Click;
                filenameLabel.TextAlign = ContentAlignment.MiddleCenter;
                Controls.Add(filenameLabel);
            }