Link to home
Start Free TrialLog in
Avatar of axnst2
axnst2Flag for United States of America

asked on

Changing the color of a drawn rectangle

Hi Experts,

   I have a user control (C# 2005 w/ .NET FW 2.0), which has a picture box. When the user control gets created for the first time, I draw a rectangle on top of it using the picture box' Graphics object and the FillRectangle (Brush, RectangleF) function (using a SolidBrush).  I have a public method, that's supposed to allow the user to change the rectangle's color.  My question is: How do I change the color of that existing rectangle? I tried saving the RectangleF object and just calling the FillRectangle function on it a second time using a different Brush color, but that returns a "Parameter is not valid" error.

Any help would be greatly appreciated.

Thanks,
axnst2
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of axnst2

ASKER

Thanks Bob,

   That was it...

~axnst2
Avatar of axnst2

ASKER

Good Job!!!!