I am working on a graphics intensive project and would like to create a class that includes a number of drawing routines. These routines could then be called from any number of places in the code. Here's an example of the type of function that I'd like to include in the class:
Private Sub DrawEllipseGeom(
ByVal numX As Integer,
ByVal numY As Integer,
ByVal numWidth As Integer,
ByVal numHeight As Integer,
ByVal colColor As Color,
ByVal LineWidth As Long)
Dim penDraw As New Pen(Drawing.Color.Black)
Dim PenColor As Color = colColor
penDraw.Color = PenColor
penDraw.Width = LineWidth
e.graphics.DrawEllipse(penDraw, numX, numY, numWidth, numHeight)
The problem I'm trying to solve concerns passing e as PaintEventArgs to the functions in the class. Is there a way to do this or do I need to rethink my approach? I understand that the example above is trivial, but some of the functions will create multiple paths, perform transformations, etc. I would prefer not to have to recreate the code on each form by overriding the paint on each form.
Thank you for reading my post.