Пример #1
0
 private void PictureBox_MouseEnter(object sender, EventArgs e)
 {
     if (Highlighter1.GetHighlightColor((Control)sender) == eHighlightColor.None)
     {
         Highlighter1.SetHighlightColor((Control)sender, eHighlightColor.Blue);
     }
 }
Пример #2
0
 private void PictureBox_MouseLeave(object sender, EventArgs e)
 {
     if (Highlighter1.GetHighlightColor((Control)sender) == eHighlightColor.Blue)
     {
         Highlighter1.SetHighlightColor((Control)sender, eHighlightColor.None);
         // FlowLayoutPanel1.Refresh()
     }
 }
Пример #3
0
        private void PictureBox_Clicked(object sender, EventArgs e)
        {
            if (lastPictureBox != sender)
            {
                if (lastPictureBox is object)
                {
                    Highlighter1.SetHighlightColor(lastPictureBox, eHighlightColor.None);
                }

                lastPictureBox = (PictureBox)sender;
                Highlighter1.SetHighlightColor(lastPictureBox, eHighlightColor.Green);
                ShowTextureInfos();
            }
        }
Пример #4
0
        private void LoadTexturesFromCategorie(TextureBlock block)
        {
            var controls = new Control[FlowLayoutPanel_Textures.Controls.Count];

            FlowLayoutPanel_Textures.Controls.CopyTo(controls, 0);
            FlowLayoutPanel_Textures.SuspendLayout();

            foreach (Control c in controls)
            {
                if (c is PictureBox)
                {
                    Highlighter1.SetHighlightColor(c, eHighlightColor.None);
                    FlowLayoutPanel_Textures.Controls.Remove(c);
                }
            }

            foreach (Material mat in block.Textures)
            {
                TextureLoadedInfos info = mat.Tag as TextureLoadedInfos;
                var pb = new PictureBox()
                {
                    Image    = mat.Image,
                    SizeMode = PictureBoxSizeMode.Zoom,
                    Tag      = mat,
                    Size     = new Size(70, 70)
                };
                pb.Click      += PictureBox_Clicked;
                pb.MouseEnter += PictureBox_MouseEnter;
                pb.MouseLeave += PictureBox_MouseLeave;
                pb.MouseClick += PictureBox_MouseClick;
                var lbl = new LabelX()
                {
                    Text          = info.Name,
                    Size          = new Size(70, 14),
                    Location      = new System.Drawing.Point(1, 55),
                    TextAlignment = StringAlignment.Center
                };
                pb.Controls.Add(lbl);
                lbl.Click      += (sender, e) => PictureBox_Clicked(pb, e);
                lbl.MouseEnter += (sender, e) => PictureBox_MouseEnter(pb, e);
                lbl.MouseLeave += (sender, e) => PictureBox_MouseLeave(pb, e);
                lbl.MouseClick += (sender, e) => PictureBox_MouseClick(pb, e);
                FlowLayoutPanel_Textures.Controls.Add(pb);
            }

            FlowLayoutPanel_Textures.ResumeLayout();
        }