如何将两个面板的一侧与Top和Fill的底座属性重叠?(How to overlap one side of two panels with dock properties of Top and Fi

编程入门 行业动态 更新时间:2024-10-14 16:21:22
如何将两个面板的一侧与Top和Fill的底座属性重叠?(How to overlap one side of two panels with dock properties of Top and Fill for each?)

我有一个无边框的形式,我想通过使用两个面板来制作边框。 一个是标题持有者,我已将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:

Sample

更多推荐

本文发布于:2023-08-07 05:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1462890.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:底座   如何将   属性   面板   两个

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!