[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Control loading (too slow/flickering) - winform

Posted on 2004-11-29
4
Medium Priority
?
1,071 Views
Last Modified: 2008-03-06
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
0
Comment
Question by:dudubravo
4 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 12697213
Try SuspendLayout before changing and ResumeLayout after changing. Form designer uses this in InitializeComponent function.
0
 
LVL 15

Expert Comment

by:SRigney
ID: 12697272
You could also add these to a panel that is not visible until they are all added.
0
 
LVL 10

Accepted Solution

by:
ptmcomp earned 500 total points
ID: 12704521
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
 

Author Comment

by:dudubravo
ID: 12706925
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question