我现在有个类似toolbar的小工具是矩形的,现要求将其美化,
将四个直角作圆滑处理,我试过把窗体画成椭圆形,但是不是那个效果
各位大虾们有何高见,希望不吝赐教,小弟非常感谢

解决方案 »

  1.   

    请问gavinhuanghsc 怎样把窗体画成圆角矩形呢,可以给个sample吗?谢谢
      

  2.   

    谢谢各位,我用下边的方法也可以实现
    protected override void OnPaint(PaintEventArgs e)
    {
    System.Drawing.Graphics dc = e.Graphics;
    Pen bluePen = new Pen(Color.Blue, 3);
    GraphicsPath gp = new GraphicsPath();
    float X = 0;
    float Y = 0;
    float width = 200;
    float height= 50;
    float radius=10; 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(); dc.DrawPath(bluePen, gp); this.Region = new Region(gp); base.OnPaint(e);
    }