Link to home
Create AccountLog in
Avatar of jdcoburn
jdcoburn

asked on

how to add a graphic object to a panel in a control

hi -- i've built a user control for use in my application. the control has a panel in it (called "hostPanel"). ultimately i want to contro the size of a rectangle on hte panel to use as an indicator. i've added the following code to the constructor for the control, but no amount of fidddlying gets teh rectangle to appear. the panel is correctly displayed with in the control, but the rectange never appears. any suggestions?
// field
Graphics gr;
// in constructor
Rectangle rct = new Rectangle(0, 0, hostPanel.Width, hostPanel.Height);
gr = hostPanel.CreateGraphics();
Brush br = new SolidBrush(Color.Red);
gr.FillRectangle(br, rct);
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of jdcoburn
jdcoburn

ASKER

thanks.