c#窗体问题 怎样使窗体变成圆角
展开全部
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);
}
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);
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
需要创建BMP图像并用代码处理!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
引用liulaijin的回答:
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);
}
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);
}
展开全部
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);
}
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);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询