How do I change pen color?

  • Thread starter Thread starter nobody
  • Start date Start date
N

nobody

Here's setting it....
Dim PenColor As New System.Drawing.Pen(System.Drawing.Color.Red)

Now how do I change "PenColor" variable?

Or, do I have to do like this below for each color?

Dim PenColor_Red As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim PenColor_Green As New System.Drawing.Pen(System.Drawing.Color.Red)
 
* nobody said:
Dim PenColor As New System.Drawing.Pen(System.Drawing.Color.Red)

Now how do I change "PenColor" variable?

Or, do I have to do like this below for each color?

Dim PenColor_Red As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim PenColor_Green As New System.Drawing.Pen(System.Drawing.Color.Red)

You will have to create a new pen (and dispose it when you don't need it
any more by calling its 'Dispose' method) or use one of the predefined
pens ('Pens.*').
 
Herfried said:
You will have to create a new pen (and dispose it when you don't need it
any more by calling its 'Dispose' method) or use one of the predefined
pens ('Pens.*').

Why use "Dispose" with managed code?


..
 
* piddie said:
Why use "Dispose" with managed code?

As Armin says, 'Dispose' cleans up unmanaged resources, like GDI(+) pen
objects and other handles.
 
Back
Top