Control loading (too slow/flickering) - winform

I have developed an app that loads and delete controls (picturebox) during run time. When I click on a picture, the app takes me to a different page. The way that I did this was to "remove" and "add" controls to the main form. The problem is that I can actually see the controls being removed and added during run time.

I had developed the same app for the web (a web app). At the time I used "ondocumentready" for when loading the page up a message box (a div tag) would appear "Processing your request". That was cool because the images were completely loaded with javascript and when they were all done, they would immediately appear all at once in the browser.

I cannot emmulate the same with a winform. I have tried also "show" and "hide" instead of "add" and "remove". No help. Same problem again.

Does anybody know how to do this?

Thanks,
Luis
dudubravoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
Try SuspendLayout before changing and ResumeLayout after changing. Form designer uses this in InitializeComponent function.
0
SRigneyCommented:
You could also add these to a panel that is not visible until they are all added.
0
ptmcompCommented:
The LockWindowUpdate function of the Platform API could help, but the problem is that .net does too many platform invokes wich slows the whole thing down - even when you surpress the repaints, it will still be slow. Try to use less controls... or create your own controls wich use less platform invokes (but this would be very much work... :o(  )
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dudubravoAuthor Commented:
ptmcomp, you're the man!

I do appreciate the other advices though. I did try each one of them. Actually I thought AlexFM's would work (I read MS info on it) but it did not work after all. I dont know why. I really tried it, but no luck. The idea of the panel was also good but gives me the same problem.

Using the LockWindowUpdate api was the shizzle, the that solved it. Thans a lot,
Luis
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.