当前位置: 移动技术网 > IT编程>开发语言>c# > C#中GraphicsPath的Widen方法用法实例

C#中GraphicsPath的Widen方法用法实例

2019年07月18日  | 移动技术网IT编程  | 我要评论

本文实例讲述了c#中graphicspath的widen方法用法。分享给大家供大家参考。具体如下:

using system;
using system.collections.generic;
using system.componentmodel;
using system.data;
using system.drawing;
using system.text;
using system.windows.forms;
using system.drawing.drawing2d;
namespace advanced_drawing
{
  public partial class form12 : form
  {
    public form12()
    {
      initializecomponent();
    }
    private void form12_paint(object sender, painteventargs e)
    {
      // create a path and add two ellipses.
      graphicspath mypath = new graphicspath();
      mypath.addellipse(0, 0, 100, 100);
      mypath.addellipse(100, 0, 100, 100);
      // draw the original ellipses to the screen in black.
      e.graphics.drawpath(pens.blue, mypath);
      // widen the path.
      pen widenpen = new pen(color.black, 10);
      matrix widenmatrix = new matrix();
      widenmatrix.translate(50, 50);
      mypath.widen(widenpen, widenmatrix, 1.0f);
      // draw the widened path to the screen in red.
      e.graphics.fillpath(new solidbrush(color.red), mypath);
    }
  }
}

希望本文所述对大家的c#程序设计有所帮助。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网