c#中Shear的使用

来源:互联网 发布:贴吧刷经验软件 编辑:程序博客网 时间:2024/06/03 23:01
 
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Drawing.Drawing2D;
  9. namespace advanced_drawing
  10. {
  11.     public partial class Form8 : Form
  12.     {
  13.         public Form8()
  14.         {
  15.             InitializeComponent();
  16.         }
  17.         private void Form8_Paint(object sender, PaintEventArgs e)
  18.         {
  19.             RectangleF rect = new RectangleF(0, 0, 100, 50);
  20.             StringFormat format = new StringFormat();
  21.             format.Alignment = StringAlignment.Center;
  22.             format.LineAlignment = StringAlignment.Center;
  23.             Matrix matrix = new Matrix();
  24.             matrix.Shear(.5f, 0f);//只在X方向上Shear
  25.             matrix.Translate(200,0);
  26.             Graphics g=e.Graphics;
  27.             g.Transform = matrix;
  28.             g.DrawString("zhuzhao"this.Font, Brushes.Blue, rect, format);
  29.             g.DrawRectangle(Pens.Black, rect.X, rect.Y, rect.Width, rect.Height);
  30.         }
  31.     }
  32. }