c#圆角

来源:互联网 发布:js 判断ie浏览器 编辑:程序博客网 时间:2024/04/28 07:38
其他类型类似
private void ListBoxDrawTest(ListBox lb, int len)
        
{
            Graphics g
=lb.CreateGraphics();
            Rectangle rect
=lb.ClientRectangle;
            GraphicsPath path 
= new GraphicsPath();
            path.AddArc(rect.Left, rect.Top, 
2 * len, 2 * len, 18090);
            path.AddLine(rect.Left 
+ len, rect.Top, rect.Right - len, rect.Top);

            path.AddArc(rect.Right 
- 2 * len, rect.Top, 2 * len, 2 * len, 27090);
            path.AddLine(rect.Right, rect.Top 
+ len, rect.Right, rect.Bottom - len);

            path.AddArc(rect.Right 
- 2 * len, rect.Bottom - 2 * len, 2 * len, 2 * len, 090);
            path.AddLine(rect.Left 
+ len, rect.Bottom, rect.Right - len, rect.Bottom);

            path.AddArc(rect.Left, rect.Bottom 
- 2 * len, 2 * len, 2 * len, 9090);
            path.AddLine(rect.Left, rect.Top 
+ len, rect.Left, rect.Bottom - len);
            lb.Region 
= new Region(path);
            
//g.DrawPath(Pens.Black, path);
        }
 
原创粉丝点击