I have a component which hooks up with the paint event of assigned control and draws on its surface, Whenever i make any changes to the component i need to resize the form or control at design time in order to see the changes.

I want to ask if there is any other way to refresh the contents of a control at design time which forces it to redraw.

Recommended Answers

All 6 Replies

Are you sure you mean design time? Design time is when you are editing the control in the designer and you wouldnt see changes to its paint event in the designer.
Do you mean you want to show changes to the control whilst the application is running? If so, thats run-time. You can call Refresh on the control to force a repaint. SO for a button called btn1 you would use btn1.Refresh()

Are you sure you mean design time? Design time is when you are editing the control in the designer and you wouldnt see changes to its paint event in the designer.
Do you mean you want to show changes to the control whilst the application is running? If so, thats run-time. You can call Refresh on the control to force a repaint. SO for a button called btn1 you would use btn1.Refresh()

Im sure its called design time.

Design time means when you are designing your applications interface, as you know you see the form you are editing because it was created by visual studios ide for you by writing code which is hidden from you the extension for this file is .designer.vb and accompanies any corresponding .vb file which has a interface or inherits from Form Class.

Now for the refresh or invalidate, i mean that if you close the design window or either resize the form or control and then re open the designer of this control again it will be rendered again

I am simply asking if i can force the designer of Visual Studio to re Render the form or control so that i can immediately see the changes.

I hope you understand what i mean now .

I understand what you mean, but i dont understand why :/ As far as i was aware, any code you place in the Paint event would process at run time.
Where abouts are you putting the code, because anything i place in a Paint event is not reflected in the designer

No thats not true, any handler that handles the paint event of a component will be executed and event will be processed for once before the form or control is displayed in designer, only difference is that you cannot place break execution at any point, unless ur using another instance of Visual studio to debug at design time.

In that case i guess i cant help you. As far as i was aware, the design view updated whenever it recieved focus. Good luck with your problem, i hope someone who knows more than me can pitch in :)

yea i hope, but thanks anyways for showing interest in solving my problem. i appreciate it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.