Mega Code Archive

 
Categories / C# / 2D Graphics
 

Reset the transformation Translate by 30 pixels in vertical direction

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, ClientRectangle);     g.DrawEllipse(Pens.Black, 20, 20, 30, 50);     g.TranslateTransform(-15, 0);     g.DrawEllipse(Pens.Black, 20, 20, 30, 50);     g.ResetTransform();     g.TranslateTransform(0, 30);     g.DrawEllipse(Pens.Black, 20, 20, 30, 50);     }     public static void Main() {         Application.Run(new Form1());     } }