试图更改标签的边框颜色 [英] Trying to change the Border Color of a label
本文介绍了试图更改标签的边框颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的工作在VB,VS2008,WinForms的。我有一些标签来创建,而我使用的边框样式= FixedSingle。
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 border? It is always defaulting to black.
推荐答案
如果您不希望创建一个自定义的控制,你可以试试这个:
If you don't want to create a custom control you can try this:
挂接到标签的Paint事件。
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);
}
从<一个拍摄href="http://social.msdn.microsoft.com/forums/en-US/winforms/thread/8f93eed6-f539-4503-93f8-88e17749275f">here通过安德烈Tozon
这篇关于试图更改标签的边框颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文