Winform窗体圆角设计代码
更新时间:2017年01月03日 11:20:57 作者:Jurieo
这篇文章主要为大家详细介绍了Winform窗体圆角设计代码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
网上看到的很多winform窗体圆角设计代码都比较累赘,这里分享一个少量代码就可以实现的圆角。主要运用了System.Drawing.Drawing2D。
效果图

代码如下
private void BeautiLoginForm_Paint(object sender, PaintEventArgs e)
{
Type(this, 25, 0.1);
}
private void Type(Control sender, int p_1, double p_2)
{
GraphicsPath oPath = new GraphicsPath();
oPath.AddClosedCurve(new Point[] {
new Point(0, sender.Height / p_1),
new Point(sender.Width / p_1, 0),
new Point(sender.Width - sender.Width / p_1, 0),
new Point(sender.Width, sender.Height / p_1),
new Point(sender.Width, sender.Height - sender.Height / p_1),
new Point(sender.Width - sender.Width / p_1, sender.Height),
new Point(sender.Width / p_1, sender.Height),
new Point(0, sender.Height - sender.Height / p_1) }, (float)p_2);
sender.Region = new Region(oPath);
}
private void BeautiLoginForm_Resize(object sender, EventArgs e)
{
Type(this, 25, 0.1);
}
代码比较简单,希望有所帮助。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
相关文章
C#设计模式之Mediator中介者模式解决程序员的七夕缘分问题示例
这篇文章主要介绍了C#设计模式之Mediator中介者模式解决程序员的七夕缘分问题,简单说明了中介者模式的定义并结合七夕缘分问题实例分析了中介者模式的具体使用技巧,需要的朋友可以参考下2017-09-09


最新评论