ASP.NET C#图形路径形状
发布时间:2020-12-16 09:36:13 所属栏目:asp.Net 来源:网络整理
导读:我在为略微修改的圆角矩形生成某个路径时遇到问题.这是我用于生成圆角矩形的代码: public static System.Drawing.Drawing2D.GraphicsPath RoundedRectangle(Rectangle r,int d) { System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D
我在为略微修改的圆角矩形生成某个路径时遇到问题.这是我用于生成圆角矩形的代码:
public static System.Drawing.Drawing2D.GraphicsPath RoundedRectangle(Rectangle r,int d) { System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath(); gp.AddArc(r.X,r.Y,d,180,90); gp.AddArc(r.X + r.Width - d,270,r.Y + r.Height - d,90); gp.AddArc(r.X,90,90); gp.AddLine(r.X,r.X,r.Y + d / 2); return gp; } 现在我需要生成这样的东西: 实现这一目标的最佳方法是什么?也许通过擦除左边框然后以某种方式添加直角三角形? 任何帮助表示赞赏,谢谢! 解决方法
看看这会对你有所帮助.
public void DrawRoundRect(Graphics g,Pen p,float x,float y,float width,float height,float radius) { GraphicsPath gp = new GraphicsPath(); gp.AddLine(x + radius,y,x + width - (radius * 2),y); // Line gp.AddArc(x + width - (radius * 2),radius * 2,90); // Corner gp.AddLine(x + width,y + radius,x + width,y + height - (radius * 2)); // Line gp.AddArc(x + width - (radius * 2),y + height - (radius * 2),90); // Corner gp.AddLine(x + width - (radius * 2),y + height,x + radius,y + height); // Line gp.AddArc(x,90); // Corner gp.AddLine(x,x,y + radius); // Line gp.AddArc(x,90); // Corner gp.CloseFigure(); g.DrawPath(p,gp); gp.Dispose(); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – ASP.Net MVC中的线程安全性
- 在为asp经典页面IIS6调试vb 6 dll时,为什么我的ObjectConte
- asp.net – 开发期间缓慢的页面刷新时间
- asp.net – System.Web.Providers – > Microsoft.AspNet.P
- asp.net – 在Web Gardens中添加动态路由
- asp.net-mvc – 找不到与Web API中的请求URI匹配的HTTP资源
- asp.net-mvc – 授权失败时将用户重定向到特定视图?
- asp.net-mvc-3 – 为什么我的自定义HTML助手结果得到html编
- 如何在ASP.NET Core类库项目中读取配置文件详解
- asp.net-mvc – 使用Ninject.Web.Mvc 2.0和ASP.NET MVC 1.0
推荐文章
站长推荐
- asp.net-mvc – 如何在html.LabelFor中显示一些文
- asp.net – PipeLine模式和池标识是否会影响使用
- asp.net – 设置从Codebehind中选择的Radiobutto
- asp.net – 脚本管理器和工具包脚本管理器之间的
- asp.net – 实体框架“等待操作超时”就简单的De
- asp.net-mvc – MVC:404路由在生产中无法正常工
- asp.net-mvc – 如何在ASP.NET MVC中定义视图级变
- asp.net-mvc – ASP.NET MVC – 使用Moq框架对Re
- asp.net-mvc-3 – Razor C# – 设置复选框值
- 实现对Asp.NetMvc及Asp.NetCore的权限控制
热点阅读