我有一个无边框的形式,我想通过使用两个面板来制作边框。 一个是标题持有者,我已将dock属性设置为top。 另一个,即表单内容区域,设置为填充填充属性。
现在,在标题栏面板下方,两个面板的边框“加起来”使它稍微大胆,这是我想要解决的问题。 看看下面的图片。
拍摄http://oi59.tinypic.com/2myrww7.jpg
我需要厚边框,就像面板的任何一侧一样,没有额外的宽度。
I have a borderless form for which i want to make a border by using two panels. One is to be a title holder for which I've set the dock property to top. The other one, that is to be the form content area, is set to dock property of fill.
Now, right beneath the titlebar panel, the two panel's borders 'add up' making it slightly bolder which is the problem I want to solve. Have a look at the image below.
Shot http://oi59.tinypic.com/2myrww7.jpg
I need the thick border just as any other side of the panel, no extra width.
最满意答案
您想要的是标准Panel无法完成的(我假设是WinForms )。 你可以:
创建自己的Panel后代并自己绘制(不应该那么难)要聪明:
2.1创建一个覆盖两个面板的面板:为其添加边框并将“ Padding和Margin设置为0
2.2使顶部面板和底部面板无边框并位于父面板内
2.3将1px高度(或边框的厚度)面板对接到顶部,顶部面板下方和底部(客户端对接)面板上,无边框但在父面板中填充边框颜色
如果你的边框不是3D,那么它看起来会像你期望的那样:
What you want can't be done with the standard Panel (I'm assuming WinForms). You can either:
Create your own Panel descendant and draw it yourself (shouldn't be that hard)Be Clever:
2.1 Create a panel which covers both panels: add a border to it and set Padding and Margin to 0
2.2 Make your top panel and bottom panel borderless and inside that parent panel
2.3 Make a 1px height (or your border's thickness) panel docked to top, under your top panel and over your bottom (client-docked) panel, borderless but filled with the border color in the parent panel
If your borders are not 3D, this will look as you expect it to:
更多推荐
发布评论