社区
C#
帖子详情
在.NET下,如何画圆角矩形? -=100分=-
Colin-Han
2006-04-13 08:12:57
如题。
...全文
298
3
打赏
收藏
在.NET下,如何画圆角矩形? -=100分=-
如题。
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
copico
2006-04-13
打赏
举报
回复
画弧+四条边
代码蜗牛sky
2006-04-13
打赏
举报
回复
protected override void OnPaintBackground(PaintEventArgs pevent)
{
//填充大的圆角矩形框
Graphics g = pevent.Graphics;
g.FillRectangle( Brushes.Lime, 0, 0, this.ClientSize.Width, this.ClientSize.Height );
System.Drawing.Drawing2D.GraphicsPath framePath = Utils.CreateRoundedRectPath(this.ClientRectangle, 5 );
using ( System.Drawing.Drawing2D.LinearGradientBrush frameLgb =
new System.Drawing.Drawing2D.LinearGradientBrush( this.ClientRectangle,
Color.SteelBlue, Color.LightBlue, System.Drawing.Drawing2D.LinearGradientMode.Vertical ) )
{
g.FillPath( frameLgb, framePath );
}
//填充小的圆角矩形框:文本区
Rectangle textAreaRectangle = new Rectangle(this.ClientRectangle.Location.X + 5,
this.ClientRectangle.Location.Y + 5,this.ClientRectangle.Size.Width - 10,
this.ClientRectangle.Size.Height - 10);
System.Drawing.Drawing2D.GraphicsPath textAreaPath = Utils.CreateRoundedRectPath(textAreaRectangle,5);
g.FillPath( Brushes.White, textAreaPath );
}
代码蜗牛sky
2006-04-13
打赏
举报
回复
public static GraphicsPath CreateRoundedRectPath( Rectangle rect, int radius )
{
GraphicsPath rectPath = new GraphicsPath();
// Add the line on the top:
rectPath.AddLine( rect.Left + radius, rect.Top,
rect.Right - radius, rect.Top );
// Add the arc at the top right corner:
rectPath.AddArc( rect.Right - 2 * radius, rect.Top,
radius * 2, radius * 2 ,
270, 90 );
// Line down the right:
rectPath.AddLine( rect.Right, rect.Top + radius,
rect.Right, rect.Bottom - 10 );
// Bottom Right quarter circle:
rectPath.AddArc( rect.Right - radius * 2, rect.Bottom - radius * 2,
radius * 2, radius * 2,
0, 90 );
// bottom line:
rectPath.AddLine( rect.Right - 2 * radius, rect.Bottom ,
rect.Left + radius, rect.Bottom );
// Bottom left quarter circle:
rectPath.AddArc( rect.Left, rect.Bottom - 2 * radius,
2 * radius, 2 * radius, 90, 90 );
// Up the left side:
rectPath.AddLine( rect.Left, rect.Bottom - radius,
rect.Left, rect.Top + radius );
// Upper left arc:
rectPath.AddArc( rect.Left, rect.Top,
2 * radius, 2 * radius, 180, 90 );
return rectPath;
}
绘制
圆角
panel
.net
制作
圆角
panel的源码
.net
制作
圆角
panel的源码 可运行
VB
.NET
让窗体的图片变成
圆角
VB
.NET
让窗体的图片变成
圆角
Android OpenGL ES绘制
圆角
矩形
演示demo源码
Android OpenGL ES绘制
圆角
矩形
演示demo源码 绘制
圆角
,详解见https://blog.csdn
.net
/github_27263697/article/details/143981399?sharetype=blogdetail&sharerId=143981399&sharerefer=PC&sharesource=github_27263697&spm=1011.2480.3001.8118 目录 1、绘制
矩形
Renderer基类
矩形
Renderer类 顶点着色器 片元着色器 2、绘制圆形 圆形Renderer类 顶点着色器 片元着色器 3、绘制
圆角
矩形
圆角
矩形
Renderer类 顶点着色器 片元着色器
.Net
绘制
圆角
窗体
特殊界面设计代码,控制窗体的边缘为
圆角
。
WPF
圆角
矩形
.zip
小米logo换新,程序员一行代码(border-radius:19px)实现,目前此行代码价值200万。C#/wpf实现
C#
111,097
社区成员
642,554
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章