WinForm------PanelControl控件中使用Pen类画角圆矩形方法
2016-11-25 15:44
218 查看
private void rightPanel_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Pen p = new Pen(Color.FromArgb(255,146,126,102)); p.Width = 8; DrawRoundRect(g, p, 110 + nowPicture * 370, 122, 292, 200, 10); } 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); gp.AddArc(X + width - (radius * 2), Y, radius * 2, radius * 2, 270, 90); gp.AddLine(X + width, Y + radius, X + width, Y + height - (radius * 2)); gp.AddArc(X + width - (radius * 2), Y + height - (radius * 2), radius * 2, radius * 2, 0, 90); gp.AddLine(X + width - (radius * 2), Y + height, X + radius, Y + height); gp.AddArc(X, Y + height - (radius * 2), radius * 2, radius * 2, 90, 90); gp.AddLine(X, Y + height - (radius * 2), X, Y + radius); gp.AddArc(X, Y, radius * 2, radius * 2, 180, 90); gp.CloseFigure(); g.DrawPath(p, gp); gp.Dispose(); }
相关文章推荐
- WinForm常用的几个控件的简单使用方法
- c#中跨线程调用windows窗体控件 .我们在做winform应用的时候,大部分情况下都会碰到使用多线程控制界面上控件信息的问题。然而我们并不能用传统方法来做这个问题,下面我将详细的介绍。
- 【转载于百度空间】C# WinForm中的BackgroundWorker控件的使用方法
- WinForm------DockManager控件的使用方法(里面包含DockPanel控件)
- WinForm------GridControl控件中使用SearchLookUpEdit控件的方法
- 邮件发送控件jmail使用方法之WinForm示例
- ASP.NET2.0中的GRIDVIEW控件在使用TemplateField中的LinkButton时如何在RowCommand事件中找到当前行index的方法
- "单击以激活并使用此控件"的解决方法
- 使用TreeView和listView控件查看本机磁盘文件夹及文件(WinForm)
- 使用TreeView和listView控件查看本机磁盘文件夹及文件(WinForm)
- 最简单的方法在DataGrid中自定义样式列(通过继承可以在Datagrid中使用下拉列表框,日期控件等)
- IE 控件一些高级使用方法
- Dev里面DataGid控件使用方法之一
- 使用ActionlessForm.cs重写Form后使得验证控件失效的解决方法
- VC中使用WebBrowser控件的两方法
- Infragistics的NetAdvantage控件使用中遇到的问题及解决方法
- 使用SendMessage方法对窗体上的控件进行截图,该方法的思想就是把控件的句柄拿到,对控件发送WM_PAINT消息,并且把希望得到图形对象的句柄当作wParam参数传过去,这样就可以在图形对象得到想要得图形。
- 如何在ASP.NET中制作Web用户自定义控件,并在aspx页面中使用它的方法和属性?
- 第三方控件使用方法
- ASP.NET2.0登陆控件的使用(常见的三种方法)