Apply the scaling transformation(scale subsequent operations by 2x horizontally and 3x vertically)

image_pdfimage_print
   
 

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

public class Form1 : Form {

    protected override void OnPaint(PaintEventArgs e) {
    Graphics g = e.Graphics;
    g.FillRectangle(Brushes.White, this.ClientRectangle);
    g.DrawRectangle(Pens.Black, 10, 10, 50, 50);
    g.DrawEllipse(Pens.Black, 10, 10, 10, 10);

    g.ScaleTransform(2.0f, 3.0f);

    g.DrawRectangle(Pens.Black, 10, 10, 50, 50);
    g.DrawEllipse(Pens.Black, 10, 10, 10, 10);
    }
    public static void Main() {
        Application.Run(new Form1());
    }
}

    


This entry was posted in 2D Graphics. Bookmark the permalink.