skylyfa 2016-09-30 08:03 采纳率: 0%
浏览 1579

picturebox 圆角问题背景颜色

自定义控件中有一个picturebox控件,采用绘画方式
public void DrawRoundRect(Graphics g, Pen p, float X, float Y, float width, float height, float radius)
{
System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.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();
    }

    填充背景颜色后效果![图片说明](https://img-ask.csdn.net/upload/201609/30/1475222388_149808.png)

    怎么改可以是背景颜色只填充在内部的这个圆角的里面
  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2016-10-03 13:14
    关注
    评论

报告相同问题?

悬赏问题

  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?