|
|
|
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);
}
Private Sub
Form1_Paint(ByVal sender
As Object,
ByVal e As
System.Windows.Forms.PaintEventArgs) Handles
MyBase.Paint
Dim
mx As 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)
End
Sub 'Form1_Paint
Return to the article.
|
|