Translate Transform three times : Transform : Graphics C# Source Code


Custom Search

C# Source Code » Graphics » Transform »

 

Translate Transform three times









    


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

public class Form1 : Form
{
      public Form1() {
            InitializeComponent();
      }
    private void SimpleStyleRenderer_Paint(object sender, PaintEventArgs e)
    {
      e.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
      DrawRectangle(e.Graphics);
      e.Graphics.TranslateTransform(180, 60);
      DrawRectangle(e.Graphics);
      e.Graphics.TranslateTransform(-50, 80);
      DrawRectangle(e.Graphics);
      e.Graphics.TranslateTransform(-100, 50);
      DrawRectangle(e.Graphics);
    }

    private void DrawRectangle(Graphics g)
    {
      Pen drawingPen = new Pen(Color.Red, 30);
      g.DrawRectangle(drawingPen, new Rectangle(20, 20, 20, 20));
    }
    private void InitializeComponent()
    {
      this.SuspendLayout();

      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(600, 600);
      this.Name = "SimpleStyleRenderer";
      this.Text = "SimpleStyleRenderer";
      this.Paint += new System.Windows.Forms.PaintEventHandler(this.SimpleStyleRenderer_Paint);
      this.ResumeLayout(false);

    }
      [STAThread]
      static void Main()
      {
        Application.EnableVisualStyles();
        Application.Run(new Form1());
      }
}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Graphics
» Transform