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

C#之图形位置组合转换代码

  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 Form9 : Form
  12.     {
  13.         public Form9()
  14.         {
  15.             InitializeComponent();
  16.         }
  17.         private void Form9_Paint(object sender, PaintEventArgs e)
  18.         {
  19.             Rectangle rect = new Rectangle(0, 0, 20, 10);
  20.             Matrix matrix = new Matrix();
  21.             matrix.Scale(2, 3);//Scale和Translate的先后顺序
  22.             matrix.Translate(10, 20);
  23.             //matrix.Translate(10, 20);
  24.             //matrix.Scale(2, 3);
  25.             Graphics g = e.Graphics;
  26.             g.Transform = matrix;
  27.             g.FillRectangle(Brushes.Blue, rect);
  28.         }
  29.     }
  30. }
补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,