当前位置:编程学习 > C#/ASP.NET >>

C#之shear的使用实例代码

  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. }
补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,