User Control Design Time Paint Issue

Winston

Junior Contributor
Joined
Jan 25, 2003
Messages
266
Location
Sydney, Australia
I'm making a user control, specifically a progress bar for some reason during design time when moving the control around and resizing it causes it to not paint properly, is there any fix to this? i've been invoking refresh calls on the location changed, size changed, resize propertys, ive also set the control style propertys, what could be the event that i should be targeting to call refresh at?

This is a screenshot of what happens after resizing.
 

Attachments

Have you overriden Paint in your custom user control? If so, that is the first place I would check for an error or complication in my code which may cause 'weirdness' in the designer.

Winston said:
I'm making a user control, specifically a progress bar for some reason during design time when moving the control around and resizing it causes it to not paint properly, is there any fix to this? i've been invoking refresh calls on the location changed, size changed, resize propertys, ive also set the control style propertys, what could be the event that i should be targeting to call refresh at?

This is a screenshot of what happens after resizing.
 
Hey, yes obviously, i have code inside the paint event, from analysing it, it seems like it wouldn't cause many problems, is there anything you would do to keep the painting updated, it's just weird that it wont happen during runtime, but it does during design time.
 
You would think that invalidating the Control in a Resize event handler would be all you needed....
Code:
if(this.DesignMode)
{
    this.Invalidate(true);				
}
However, I have seen enough peculiar things happen in the designer that leads me to believe it is a shot in the dark sometimes.


Winston said:
Hey, yes obviously, i have code inside the paint event, from analysing it, it seems like it wouldn't cause many problems, is there anything you would do to keep the painting updated, it's just weird that it wont happen during runtime, but it does during design time.
 
Nope that didn't help either, it's strange, i don't quite understand, there has to be something that needs to be done to keep the control being repainted nicely, because default .NET components when moved around and resize dont cause such issues, i know for one what those left over grey bits are, they're from resizing the control or moving the control around's selected border, if you get what i mean, anyways, any other suggestions that i could try out?

Thanks
 
Back
Top