How to change the color of the frame for photoshop (winform)?

I want to set the color and style of the frame around the image window depending on different events.

Are there any properties or functions that help me achieve this goal?

+5
source share
4 answers

Winforms does not allow you to change the color of the border of controls; they are fixed according to the theme selected by the user. The easiest way to get what you want, which does not require writing your own control, is to place the image window inside the panel, making it a little smaller. Then just change the BackColor panel.

, , " " "" , .

+5

, :

, Paint Picturebox:

private void pictureBox1_Paint_1(object sender, PaintEventArgs e)
    {
        ControlPaint.DrawBorder(e.Graphics, pictureBox1.ClientRectangle, Color.Red, ButtonBorderStyle.Solid);
    }

, , mouseclick, Tag , Click , . :

  if (pictureBox1.Tag == null) { pictureBox1.Tag = Color.Red; } //Sets a default color
  ControlPaint.DrawBorder(e.Graphics, pictureBox1.ClientRectangle, (Color)pictureBox1.Tag, ButtonBorderStyle.Solid);

Clickbox , :

private void pictureBox1_Click(object sender, EventArgs e)
        {
            if ((Color)pictureBox1.Tag == Color.Red) { pictureBox1.Tag = Color.Blue; }
            else {pictureBox1.Tag = Color.Red; }
            pictureBox1.Refresh();
        }

using System.Drawing; pictureBox1.Refresh() . !

+3

( VB.NET, ), . , , Passant.

+2

, MouseEnter MouseLeave MouseHover, OnPaint . PictureBox , .

+1

All Articles