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

C#中Shear的用法实例

程序员文章站 2023-11-21 16:12:34
本文实例讲述了c#中shear的用法。分享给大家供大家参考。具体如下: using system; using system.collections.gener...

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

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 form8 : form
  {
    public form8()
    {
      initializecomponent();
    }
    private void form8_paint(object sender, painteventargs e)
    {
      rectanglef rect = new rectanglef(0, 0, 100, 50);
      stringformat format = new stringformat();
      format.alignment = stringalignment.center;
      format.linealignment = stringalignment.center;
      matrix matrix = new matrix();
      matrix.shear(.5f, 0f);//只在x方向上shear
      matrix.translate(200,0);
      graphics g=e.graphics;
      g.transform = matrix;
      g.drawstring("zhuzhao", this.font, brushes.blue, rect, format);
      g.drawrectangle(pens.black, rect.x, rect.y, rect.width, rect.height);
    }
  }
}

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