Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Changing pen width and color after declaration

Im trying to make a small paint program for a PPC in VB.NET, and i've got the freehand drawing to work. But i cant seem to change the width or color of a pen after it's declaration.

Declared like this
Public pen As Pen = New Pen(Black, 2.5)
I've tried
pen.Dispose()
pen = New Pen(drawColor, drawSize)
and something like

pen.Color = drawColor
pen.Width = drawSize

but it doesnt seem to do anything.

I also have a problem with my app not closing clean. It stays in memory after it has been closed, i have even put this in my Form_Closed sub
Me.Dispose()
drawArea.Dispose()
Application.Exit()
[693 byte] By [Killa631] at [2007-11-11 10:25:48]
# 1 Re: Changing pen width and color after declaration
What are the values of drawColor and drawSize when you try to change your pen. Either method you used to change your pen will work, so my guess is drawColor and drawSize aren't what you are expecting.
TwoFaced at 2007-11-11 20:47:51 >
# 2 Re: Changing pen width and color after declaration
Euh... guess what..
I solved it :/
I forgot to attach the event handlers to the menus :p
Dumb dumb dumb...

Thx for the reply though :)
Killa631 at 2007-11-11 20:48:47 >