微軟的winform視覺樣式一直讓我困惑。使用VisualStyles控件的邊框顏色
我想要一個Panel
坐在TreeView
旁邊,只是有相同的VisualStyle邊框。
正如你所看到的,TreeView
邊界比我的畫不同的嘗試,我Panel
。面板的BorderStyle設置爲None。
我已經試過這樣:
Rectangle r = new Rectangle(0, 0, panel1.ClientRectangle.Width - 1, panel1.ClientRectangle.Height - 1);
using (Pen p = new Pen(VisualStyleInformation.TextControlBorder))
e.Graphics.DrawRectangle(p, r);
,我已經試過這樣:
VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.TextBox.TextEdit.Normal);
renderer.DrawEdge(e.Graphics, panel1.ClientRectangle,
Edges.Bottom | Edges.Left | Edges.Right | Edges.Top,
EdgeStyle.Sunken, EdgeEffects.Flat);
任何建議正確的視覺邊界的顏色或視覺元素使用?
我現在在玩DrawThemeBackground。 Paint.NET告訴我TreeView的邊框顏色是(130,135,144)。你的Tab.Pane.Normal建議非常接近,但它是(137,140,149)。 – LarsTech