Flickers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?=

    #1

    Flickers

    Hi all,

    We have a windows forms application with different controls used
    inside, each control has several input items such as textboxes , custom
    labels, user controls, and some treeviews.. etc.


    We have been trying to eliminate flickering issues when loading different
    controls or switching to different views with no luck, and have been trying
    different suggested methods to get rid of the flickering such as:
    - this.SetStyle(C ontrolStyles.Op timizedDoubleBu ffer, true);
    - this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int, true);
    - SuspendItemsLay out();
    - ResumeItemsLayo ut();


    Unfortunately using the above code in each control or the main form
    didn't help too, I'm wondering desperately if there is another way to
    fix this annoying problem?


    FYI: We are using Visual Studio 2005 Team Suite SP2/ .NET 2.0 running on
    mainly
    Windows XP Professional SP2 on 3.20 GHz multithreaded CPU and 1GB RAM.


    Thanks for your help. Regards, greetings

    --


    http://www.setbb.com/putainformatica...opic.php?p=843


  • Udo Nesshoever

    #2
    Re: Flickers

    === original message ===
    from: Alhambra Eidos Kiquenet
    date: 01.08.2008 09:49
    Hi all,
    >
    We have a windows forms application with different controls used
    inside, each control has several input items such as textboxes , custom
    labels, user controls, and some treeviews.. etc.
    >
    >
    We have been trying to eliminate flickering issues when loading different
    controls or switching to different views with no luck, and have been trying
    different suggested methods to get rid of the flickering such as:
    - this.SetStyle(C ontrolStyles.Op timizedDoubleBu ffer, true);
    - this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int, true);
    - SuspendItemsLay out();
    - ResumeItemsLayo ut();
    >
    >
    Unfortunately using the above code in each control or the main form
    didn't help too, I'm wondering desperately if there is another way to
    fix this annoying problem?
    Did you try the simple 'DoubleBuffer = true;'

    Cheers,
    Udo

    Comment

    • Pavel Minaev

      #3
      Re: Flickers

      On Aug 1, 11:49 am, Alhambra Eidos Kiquenet
      <AlhambraEidosK ique...@discuss ions.microsoft. comwrote:
       Hi all,
      >
      We have a windows forms application with different controls used
      inside, each control has several input items such as textboxes , custom
      labels, user controls, and some treeviews.. etc.
      >
      We have been trying to eliminate flickering issues when loading different
      controls or switching to different views with no luck, and have been trying
      different suggested methods to get rid of the flickering such as:
      - this.SetStyle(C ontrolStyles.Op timizedDoubleBu ffer, true);
      - this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int, true);
      - SuspendItemsLay out();
      - ResumeItemsLayo ut();
      >
      Unfortunately using the above code in each control or the main form
      didn't help too, I'm wondering desperately if there is another way to
      fix this annoying problem?
      One dangerous trick is to use P/Invoke to send WM_SETREDRAW message to
      enable/disable redrawing for a specific control. You disable redrawing
      before a batch of updates, and enable them once you're done. Something
      like this:

      internal const int WM_SETREDRAW = 0x000B;

      [DllImport("user 32", CharSet = CharSet.Auto)]
      internal static extern IntPtr SendMessage(Int Ptr hWnd, int
      msg, int wParam, IntPtr lParam);

      void UpdatingMethod( )
      {
      try
      {
      SendMessage(con trol.Handle, Win32.WM_SETRED RAW, 0,
      IntPtr.Zero);
      // Perform your updates here
      ...
      }
      finally
      {
      SendMessage(con trol.Handle, Win32.WM_SETRED RAW, 1,
      IntPtr.Zero);
      }
      }

      Comment

      • =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?=

        #4
        Re: Flickers

        What about window form designer code ?? This code has method like
        SuspendLayout and others , how can I do updates of control with my custom
        control ?

        any sample, please ?

        Thanks.

        Comment

        • Pavel Minaev

          #5
          Re: Flickers

          On Aug 1, 5:01 pm, Alhambra Eidos Kiquenet
          <AlhambraEidosK ique...@discuss ions.microsoft. comwrote:
          What about window form designer code ??
          What about it? Flicker typically occurs when you're updating a large
          number of controls on the form; whether they were created in the
          designer or by hand is entirely irrelevant. You can get the handle of
          the entire form, or of a specific panel with controls, by using its
          Handle property; and then just do the trick I've described above.
          any sample, please ?
          Since we have no idea what exactly you're doing that's causing the
          flicker - since you haven't posted any code - there isn't much that
          can be added.

          Comment

          Working...