Screen Flickering

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wolfsbane
    New Member
    • Feb 2008
    • 5

    Screen Flickering

    On one of my apps everytime a person tabs from tab index 0 to 1 the screen flickers, but it only happens once per lifecycle of any particular form, its like it is getting a redraw request or something. Any ideas? It only happens on this particular app, and its just a simple fill in the blanks and update the DB app. It has a background image that is set to stretch with the form if it resizes but no one ever resizes the app anyhow.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    What version of VB?

    If there are a lot of controls on the tab, I guess it might take a little while to render them the first time they're shown. You could try playing with various properties such as (I'm talking VB6 here...) AutoRedraw, ClipControls and so on.

    Also, it might be worth playing around to work out what is producing the delay. In other words, remove the background image to see whether it's implicated, and so on.

    Comment

    • wolfsbane
      New Member
      • Feb 2008
      • 5

      #3
      Well the amount of controls varies from one form to another, but the most basic is the login, it just has the back ground image and 2 text boxes with the appropriate labels and a submit button, the tab order is 0,1,2 (username,passw ord,submit respectively). The most control heavy form is the add a new record form with about a dozen text fields and combo boxes, i'll try removing the bg image. The original file is large 1900x1200 and set to auto stretch or shrink given the size of the form. Someone in the office uses this app full screen at 1900x1200 so the bg does have to be that large, to keep the bg looking sharp at the higher resolution and the person using the app happy for the 2 minutes they use it. But the thing of it is the bg image is only 1mb in total file size and every machine here has at least 2GB RAM and the whoel app running at it's highest only takes up about 50MB of Memory. By the way I'm using Visual Studio 2008. And like I said it only happens once per life cycle of any form and just from tab order 0 to tab order 1 after that you can cycle through all the tab orders 0-infinity all you want and can't make it flicker.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        I'd just like to point out that if that's a 1MB JPEG image then there could be rather a lot of rendering work involved to get it on the screen. A bitmap of some sort might waste tons of space somewhere but display much quicker.

        However, the image is probably not the issue. I thought we were talking about a tabbed interface. You know, a bunch of "file tabs" along the top or side, that allow you to switch between a bunch of different groups of controls. Like the tabbed browsing in Firefox, and so on. But in fact it now sounds as though you were just referring to the tab order of the controls on the form.

        So, at a guess this might be something to do with loading the code behind the form. Perhaps there is a large amount of code, and VB isn't loading it until the user interacts with the form? Perhaps you have something which is being done in an event procedure, and either it's only performed once per form, or involves some long and complex code, or a big array of objects or something, which takes a little time to load.

        You might want to play around with the form's load event procedure for instance, to try and force whatever-it-is to load immediately.

        This is all guesswork of course, and keep in mind I'm a VB6 programmer and have never used your version.

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          P.S. Does VB2008 have options that allow you to defer loading things into RAM until they're needed? There might be some tweaking you can do there.

          Comment

          • wolfsbane
            New Member
            • Feb 2008
            • 5

            #6
            Well it actually did turn out to be the background image making it flicker, I removed the image and the flickering stopped so I played around with it and experimented with bitmaps to png's and it still flickered. Then I found a little form property called double buffer, I set it to true for all of my forms and the flickering is gone no matter what kind of background I use. Thanks for the suggestion about the background image and all the other advice I need all of it I can get!

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Originally posted by wolfsbane
              Thanks for the suggestion about the background image and all the other advice I need all of it I can get!
              Don't we all. :)

              Glad we could help.

              Comment

              Working...