using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form4 : Form
    {
        public Form4()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 坐标缩放
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            g.Clear(Color.White);
            Pen myPen = new Pen(Color.Red, 3);
            g.ScaleTransform(3, 3);//关键变换语句：放大3倍
            g.DrawRectangle(myPen, 0, 0, 200, 100);
            g.DrawEllipse(myPen, 0, 0, 200, 100);
            g.Dispose();
            myPen.Dispose();
        }
        /// <summary>
        /// 新绘制界面时候
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form4_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = this.CreateGraphics();
            g.Clear(Color.White);
            Pen myPen = new Pen(Color.Red, 3);
            g.DrawRectangle(myPen, 0, 0, 200, 100);
            g.DrawEllipse(myPen, 0, 0, 200, 100);
            g.Dispose();
            myPen.Dispose();
        }
    }
}