Form update

  • Thread starter Thread starter J L
  • Start date Start date
J

J L

I am removing and adding picture boxes on a form. I would like to have
the old image form remain until I have completed the changes. Is that
possible? As it is now, the form appears to blink as I remove the old
images and add the new ones. And the set of images displayed is not
the same from one state to the next. So I delete all the old ones
first (effectively clearing the screen) before adding the new ones.

Hope that makes sense,
TIA,
John
 
JL,

You need to set them than first in there own bitmaps.

Now you have probably something as picturecox.imagefromfile

I hope this helps,

Cor
 
J L said:
I am removing and adding picture boxes on a form. I would like to have
the old image form remain until I have completed the changes. Is that
possible? As it is now, the form appears to blink as I remove the old
images and add the new ones. And the set of images displayed is not
the same from one state to the next. So I delete all the old ones
first (effectively clearing the screen) before adding the new ones.


Take a look at 'Control.SuspendLayout' and 'Control.ResumeLayout' for
suspending layouting.

If you want to prevent a control from redrawing, take a look at the article
below:

Preventing controls from redrawing
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=disableredrawing&lang=en>
 
Hi Herfried
I thought SuspendLayout and ResumeLayout would be what I need. But it
appears that if you use this on a form, the underlying controls still
draw themselves in sequence once you resume layout.

What I did was wrap my code in me.SuspendLayout and me.ResumeLayout. I
then did a loop and removed all of the picture boxes on the form and
then a second loop and added them back. The screen blinked blank
showing I had removed the picture boxes and then displayed them.

Am I missing something?

TIA,
John
 
J L said:
I thought SuspendLayout and ResumeLayout would be what I need. But it
appears that if you use this on a form, the underlying controls still
draw themselves in sequence once you resume layout.

What I did was wrap my code in me.SuspendLayout and me.ResumeLayout. I
then did a loop and removed all of the picture boxes on the form and
then a second loop and added them back. The screen blinked blank
showing I had removed the picture boxes and then displayed them.

Am I missing something?

Did you take a look at the 2nd solution I included in my post?

'SuspendLayout' will only disable layout logic, which includes docking and
anchoring for controls. It won't prevent them from being redrawn.
 
OMG! That works prefectly. How do you know all this STUFF!! LOL

Thank you very very much. Also one note to those that are interested,
be sure to put the code that redraws and refreshes in a Finally clause
or you can get hosed.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top