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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

paint question 4
GDI Question 4
RichTextBox.selection 2
Visual Studio 2005: VB fill circle automatic 4
variable declaration errors in VS 2005 2
regex evaluator 1
A One Pixel Long Line 13
Simple Graphics Question 5

Back
Top