.net 在winforms中绘制水平分隔线
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3296110/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Draw horizontal divider in winforms
提问by Nathan
In the standard windows installer there is a divider between the control buttons on the bottom and the main part of the form. Does anyone know how this would be done in winforms/.net? I've tried fiddling around with the border settings on Panel controls etc, but haven't been able to get the same result...
在标准的 Windows 安装程序中,底部的控制按钮和窗体的主要部分之间有一个分隔线。有谁知道这将如何在 winforms/.net 中完成?我试过摆弄面板控件等上的边框设置,但无法获得相同的结果......


回答by David Anderson
I used Spy++ to figure this out a while ago and discovered that it's just a standard Win32 Static control -- the equivalent of the WinForms Label. Steps for getting the same effect:
不久前我使用 Spy++ 解决了这个问题,发现它只是一个标准的 Win32 静态控件——相当于 WinForms 标签。获得相同效果的步骤:
- Add a Label control to your form.
- Set Label Text to empty.
- Set BorderStyle to Fixed3D.
- Set AutoSize to false.
- Set Height to 2 (most easily accomplished by typing 2 into the Size/Height field under Label Properties).
- 向窗体添加一个 Label 控件。
- 将标签文本设置为空。
- 将 BorderStyle 设置为 Fixed3D。
- 将 AutoSize 设置为 false。
- 将高度设置为 2(通过在标签属性下的大小/高度字段中键入 2 最容易实现)。

