public void
Paint(Graphics g)
{
//The current state of the graphics object is saved.
GraphicsState
gs=g.Save();
//An identity matrix
Matrix
mx=new Matrix();
//is multiplied by the current transform
mx.Multiply(g.Transform);
//and then by the transform of the object being drawn
mx.Multiply(this.Transform);
g.Transform=mx;
//The object being drawn paints itself
DoPaint(g);
//Each child object paints itself also
//by recursing into this method
foreach(GraphicObject
o in this.Nodes)
{
o.Paint(g);
}
//The original state of the graphics object is restored.
g.Restore(gs);
}
Public Sub
Paint(g As Graphics)
Dim gs As
GraphicsState = g.Save()
Dim
mx As New
Matrix()
mx.Multiply(g.Transform)
mx.Multiply(Me.Transform)
g.Transform = mx
DoPaint(g)
Dim o As
GraphicObject
For Each o
In Me.Nodes
o.Paint(g)
Next o
g.Restore(gs)
End Sub
'Paint