求 QQ四边圆角大小的 region,自己画老是画不出感觉。谢谢

解决方案 »

  1.   

    http://elovenana.spaces.live.com/blog/cns!3816F973ACB0280A!156.entry这个例子给出的圆角太小了.
      

  2.   

    Fuzzy DropShadows in GDI+
    http://www.codeproject.com/cs/media/FuzzyDropShadows.asp
      

  3.   

    参考下下面的代码:protected override void OnLoad(EventArgs e)
    {
    base.OnLoad(e);
    this.Region = getFormRegion();
    }
    private Region getFormRegion()
    {
    int arcWidth = 20;
    GraphicsPath path = new GraphicsPath();
    path.AddArc(new Rectangle(0, 0, arcWidth, arcWidth), 180, 90);
    path.AddLine(arcWidth / 2, 0, this.Width - arcWidth / 2, 0);
    path.AddArc(new Rectangle(this.Width - 1 - arcWidth, 0, arcWidth, arcWidth), 270, 90);
    path.AddLine(this.Width, arcWidth / 2, this.Width, this.Height - arcWidth / 2);
    path.AddArc(new Rectangle(this.Width - 1 - arcWidth, this.Height - 1 - arcWidth, arcWidth, arcWidth), 0, 90);
    path.AddLine(this.Width - arcWidth / 2, this.Height, arcWidth / 2, this.Height);
    path.AddArc(new Rectangle(0, this.Height - 1 - arcWidth, arcWidth, arcWidth), 90, 90);
    path.AddLine(0, this.Height - arcWidth / 2, 0, arcWidth / 2);
    path.CloseFigure();
    return new Region(path);
    }
      

  4.   

    我把20改成了10和我的QQ比了一下是一样的:
    protected override void OnLoad(EventArgs e)
    {
    base.OnLoad(e);
    this.Region = getFormRegion();
    }
    private Region getFormRegion()
    {
    int arcWidth = 10;
    GraphicsPath path = new GraphicsPath();
    path.AddArc(new Rectangle(0, 0, arcWidth, arcWidth), 180, 90);
    path.AddLine(arcWidth / 2, 0, this.Width - arcWidth / 2, 0);
    path.AddArc(new Rectangle(this.Width - 1 - arcWidth, 0, arcWidth, arcWidth), 270, 90);
    path.AddLine(this.Width, arcWidth / 2, this.Width, this.Height - arcWidth / 2);
    path.AddArc(new Rectangle(this.Width - 1 - arcWidth, this.Height - 1 - arcWidth, arcWidth, arcWidth), 0, 90);
    path.AddLine(this.Width - arcWidth / 2, this.Height, arcWidth / 2, this.Height);
    path.AddArc(new Rectangle(0, this.Height - 1 - arcWidth, arcWidth, arcWidth), 90, 90);
    path.AddLine(0, this.Height - arcWidth / 2, 0, arcWidth / 2);
    path.CloseFigure();
    return new Region(path);
    }