这个实例演示了Matrix.Scale()方法,这个方法可以使坐标系放大,放大后的效果如下:
MSDN实例之二:Matrix.Scale 
 
 
 
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 Scale
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Pen myPen = new Pen(Color.Blue, 1);
            Pen myPen2 = new Pen(Color.Red, 1);

            // Draw the rectangle to the screen before applying the
            // transform.
            e.Graphics.DrawRectangle(myPen, 30, 30, 50, 50);

            // Create a matrix and scale it.
            Matrix myMatrix = new Matrix();
            myMatrix.Scale(4, 4, MatrixOrder.Append);

            // Draw the rectangle to the screen again after applying the
            // transform.
            e.Graphics.Transform = myMatrix;
            e.Graphics.DrawRectangle(myPen2, 30, 30, 50, 50);
        }
    }
}

相关文章:

  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2021-04-19
猜你喜欢
  • 2021-06-11
  • 2021-07-26
  • 2022-12-23
  • 2021-12-02
  • 2022-01-24
  • 2022-02-23
相关资源
相似解决方案