Trying to change the Border Color of a label

后端 未结 3 1308
青春惊慌失措
青春惊慌失措 2021-01-01 10:57

I\'m working in VB, VS2008, winforms. I\'ve got some labels to create, and I\'m using the BorderStyle = FixedSingle.

Is there any way to change the color of this bo

3条回答
  •  独厮守ぢ
    2021-01-01 11:45

    If you don't want to create a custom control you can try this:

    Hook up to the Label's paint event.

    void label1_Paint(object sender, PaintEventArgs e)
    {
        ControlPaint.DrawBorder(e.Graphics, label1.DisplayRectangle, Color.Blue, ButtonBorderStyle.Solid);
    }
    

    Taken from here by Andrej Tozon

提交回复
热议问题