如何更改面板边框颜色 [英] How to change Panel Border Color
问题描述
IDE:Visual Studio,C#.net,Type = Windows窗体应用程序
IDE : Visual Studio, C#.net,Type= Windows form application
在面板属性中,我已将边框样式设置为固定单个。 >
,当我运行我的应用程序时,它会给我灰色的颜色。我不知道如何更改边框的颜色。
我在面板的Paint事件中尝试过
Hi, In Panel Properties I have set the border style to Fixed Single".
when I am running my application its giving me Grey color. I don't know How to change the border color.
I have tried in Paint event of panel
private void HCp_Paint(object sender, PaintEventArgs e)
{
Panel p = sender as Panel;
ControlPaint.DrawBorder(e.Graphics, p.DisplayRectangle, Color.Yellow, ButtonBorderStyle.Inset);
}
它给了我这样的边界:
http: //i772.photobucket.com/albums/yy9/yogeshkmrsoni/giving_zps877730fc.png
我想要这样固定单个边框:
and I want fixed single border like this:
http://i772.photobucket.com/albums/yy9/ og eshkmrsoni / want_zps081e3591.png
我能够获得FixedSingle Border,但是它是灰色的,这是系统或IDE的默认设置。
I am able to get FixedSingle Border but it is in Grey color which is default by system or IDE.
所以请建议我如何使它变成黄色。
So pls suggest me how I make it in yellow color.
推荐答案
以防万一您不想将自定义面板设置为 Sinatra 回答:
just in case you dont want to make custom panel as Sinatra answered:
private void panel1_Paint(object sender, PaintEventArgs e)
{
ControlPaint.DrawBorder(e.Graphics, this.panel1.ClientRectangle, Color.DarkBlue, ButtonBorderStyle.Solid);
}
这篇关于如何更改面板边框颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!