問題描述
GroupBox 控件中的圓角 (Rounded corners in GroupBox control)
如何在表單中的 GroupBox 中獲得圓角?屬性選項卡中是否有任何選項?
參考解法
方法 1:
When visual styles are enabled for your application and the FlatStyle
property is set to "System", the group boxes look like they have slightly rounded corners, but it's probably no more than 3 to 5 degrees. So I suppose this is not what you're looking for.
Unfortunately, there's no built‑in way to customize its degree of roundedness. The only real solution is to use a custom control. You can either inherit off of the existing GroupBox
control and override its Paint
event to draw the borders yourself, or you can use one of these existing controls:
- http://roundedgroupbox.codeplex.com/
- http://weblogs.asp.net/andrewrea/archive/2008/02/18/my‑own‑version‑of‑a‑winforms‑rounded‑groupbox‑with‑transparency.aspx
- http://www.codeproject.com/KB/miscctrl/grouper.aspx
方法 2:
Take a look at this open source controls: http://roundedgroupbox.codeplex.com/
(by Srivastava、Cody Gray、user523650)