欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-07-22 20:39:29
本文实例讲述了c#中graphicspath的widen方法用法。分享给大家供大家参考。具体如下: using system; using system.col...

本文实例讲述了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#程序设计有所帮助。