主窗体上的 C# 子窗体具有灰色效果
C# child form over main form having greyed out effect
我想要一个子窗体显示在主窗体之上,周围的所有空白区域都具有一定的不透明度。我使用 .
中提供的解决方案实现了相同的效果
现在我希望子窗体中使用的面板具有圆角。有帮助吗?
我使用 link 下面的面板来制作圆角。面板有圆角,但矩形线(在图像中突出显示)仍然可见。有什么办法让它消失吗?
http://www.openwinforms.com/creating_cool_gradient_panel_gdi.html
我找到了解决方案。
在表单绘制中添加:
this.BackColor = Color.Lime;
this.TransparencyKey = Color.Lime;
var hb = new HatchBrush(HatchStyle.Percent60, this.TransparencyKey);
e.Graphics.FillRectangle(hb, this.DisplayRectangle);
在表单加载时使面板边缘变圆,其中 ctrl = 面板。
Rectangle bounds = new Rectangle(0, 0, ctrl.Width, ctrl.Height);
int iCornerRadius = 20;
GraphicsPath gpath = new GraphicsPath();
gpath.AddArc(bounds.X, bounds.Y, iCornerRadius, iCornerRadius, 180, 90);
gpath.AddArc(bounds.X + bounds.Width - iCornerRadius, bounds.Y, iCornerRadius, iCornerRadius, 270, 90);
gpath.AddArc(bounds.X + bounds.Width - iCornerRadius, bounds.Y + bounds.Height - iCornerRadius, iCornerRadius, iCornerRadius, 0, 90);
gpath.AddArc(bounds.X, bounds.Y + bounds.Height - iCornerRadius, iCornerRadius, iCornerRadius, 90, 90);
gpath.CloseAllFigures();
ctrl.Region = new Region(gpath);
ctrl.Show();
我想要一个子窗体显示在主窗体之上,周围的所有空白区域都具有一定的不透明度。我使用
现在我希望子窗体中使用的面板具有圆角。有帮助吗?
我使用 link 下面的面板来制作圆角。面板有圆角,但矩形线(在图像中突出显示)仍然可见。有什么办法让它消失吗? http://www.openwinforms.com/creating_cool_gradient_panel_gdi.html
我找到了解决方案。
在表单绘制中添加:
this.BackColor = Color.Lime;
this.TransparencyKey = Color.Lime;
var hb = new HatchBrush(HatchStyle.Percent60, this.TransparencyKey);
e.Graphics.FillRectangle(hb, this.DisplayRectangle);
在表单加载时使面板边缘变圆,其中 ctrl = 面板。
Rectangle bounds = new Rectangle(0, 0, ctrl.Width, ctrl.Height);
int iCornerRadius = 20;
GraphicsPath gpath = new GraphicsPath();
gpath.AddArc(bounds.X, bounds.Y, iCornerRadius, iCornerRadius, 180, 90);
gpath.AddArc(bounds.X + bounds.Width - iCornerRadius, bounds.Y, iCornerRadius, iCornerRadius, 270, 90);
gpath.AddArc(bounds.X + bounds.Width - iCornerRadius, bounds.Y + bounds.Height - iCornerRadius, iCornerRadius, iCornerRadius, 0, 90);
gpath.AddArc(bounds.X, bounds.Y + bounds.Height - iCornerRadius, iCornerRadius, iCornerRadius, 90, 90);
gpath.CloseAllFigures();
ctrl.Region = new Region(gpath);
ctrl.Show();