In Depth Banner
Skip Navigation Links

Select your preferred language

Drawing code for simple shapes.

    private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)

    {

      Matrix mx=new Matrix();

      mx.Translate(100,100);

      mx.Scale(100,100);

      mx.Rotate(30);

      e.Graphics.Transform=mx;

      e.Graphics.FillRectangle(Brushes.Red,-0.5f,-0.5f,1,1);

      mx=new Matrix();

      mx.Translate(200,100);

      mx.Scale(50,50);

      mx.Rotate(-20);

      e.Graphics.Transform=mx; 

      e.Graphics.FillRectangle(Brushes.Green,-0.5f,-0.5f,1,1);

    }

 

 

Return to the article

Copyright © Bob Powell 2003-2009. All rights reserved