Stop Form Update

  • Thread starter Thread starter Jon Vaughan
  • Start date Start date
J

Jon Vaughan

I have a form that im using to draw buttons onto, a click on the buttons
will cause the text on the buttons to change and some buttons will be hidden
, so im looking to stop the redraw on the form until I have finished making
these changes, to reduce the flicker. Can someone tell me how to do it ?

Thanks
 
Hi,

Checkout the 'Windows Forms Designer' region, for the line that is
Me.SuspendLayout.

That's what you need>

Rgds, Phil
 
Jon Vaughan said:
I have a form that im using to draw buttons onto, a click on the buttons
will cause the text on the buttons to change and some buttons will be
hidden , so im looking to stop the redraw on the form until I have finished
making these changes, to reduce the flicker. Can someone tell me how to do
it ?


If you want to prevent docked and anchored controls from resizing
immediately, check out the form's or container's 'SuspendLayout' and
'ResumeLayout' methods. Some controls provide 'BeginUpdate' and 'EndUpdate'
methods to disable updating. You can use the method described in the
article referenced below to disable redrawing of forms and controls:

Preventing controls from redrawing
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=disableredrawing&lang=en>
 
Jon said:
I have a form that im using to draw buttons onto, a click on the buttons
will cause the text on the buttons to change and some buttons will be hidden
, so im looking to stop the redraw on the form until I have finished making
these changes, to reduce the flicker. Can someone tell me how to do it ?

Thanks

well, not sure it's the best way, but what I'm thinking you could try is
to override the onpaint procedure and not allow the painting unless you
say to:

in the form class:
public overrides sub OnPaint(...)
if DoneDrawing then
mybase.onpaint(...)
end if
end sub

However I don't think that it is the form painting that you are worrying
about, it's the button painting. When you say "using to draw buttons
onto" are you using windows.forms.buttons or did you create your own button?

Chris
 
Back
Top