c#窗体问题 怎样使窗体变成圆角

如题所述

你可以把窗体FormBorderStyle设置成None,然后用一张有图角的图片做背景,
把窗体的TransparencyKey设置成,圆角的图片处的颜色。这样就可以。

一般的Splash界面(一般软件如adobe加载时的不规则界面的效果)都是这样做的~
温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2018-03-30
using System.Drawing.Drawing2D;
protected override void OnPaint( System.Windows.Forms.PaintEventArgs e )
{
GraphicsPath oPath = new GraphicsPath();
int x=0;
int y=0;
int w=Width;
int h=Height;
int a=40;
Graphics g=CreateGraphics();
oPath.AddArc(x,y,a,a,180,90);
oPath.AddArc(w-a,y,a,a,270,90);
oPath.AddArc(w-a/2,h-a/2,a/2,a/2,0,90);
oPath.AddArc(x,h-a,a,a,90,90);
oPath.CloseAllFigures();
Region=new Region(oPath);
}本回答被网友采纳
第2个回答  2011-10-13
需要创建BMP图像并用代码处理!
第3个回答  2018-05-13
using System.Drawing.Drawing2D;
protected override void OnPaint( System.Windows.Forms.PaintEventArgs e )
{
GraphicsPath oPath = new GraphicsPath();
int x=0;
int y=0;
int w=Width;
int h=Height;
int a=40;//这是圆角的半径
Graphics g=CreateGraphics();
oPath.AddArc(x,y,a,a,180,90);
oPath.AddArc(w-a,y,a,a,270,90);
oPath.AddArc(w-a,h-a,a,a,0,90); //这个角应该是这样的
oPath.AddArc(x,h-a,a,a,90,90);
oPath.CloseAllFigures();
Region=new Region(oPath);
}
相似回答