Flicker in window resize, controls

This is a discussion on Flicker in window resize, controls within the Windows Programming forums, part of the Platform Specific Boards category; I have several controls that need to be scaled when a window is to be resized. I am doing so ...

  1. #1
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465

    Flicker in window resize, controls

    I have several controls that need to be scaled when a window is to be resized. I am doing so using Begin/End/DeferWindowPos.

    Code:
    int ScaleWindowControls(HWND hwnd, int x, int y)
    {
        HWND chatwnd = ::GetDlgItem(hwnd, IDC_CHATTY);
        HWND mainwnd = ::GetDlgItem(hwnd, IDC_MAIN);
        HWND entrbtn = ::GetDlgItem(hwnd, IDC_BUTTON);
        
        if(!chatwnd || !mainwnd || !entrbtn)
            return 0;
        
        HDWP collection = ::BeginDeferWindowPos(3);
        
        collection = ::DeferWindowPos(collection, entrbtn, 0, x - 37, 
                                      y - 20, 36, 19, SWP_NOZORDER);
        
        collection = ::DeferWindowPos(collection, mainwnd, 0, 1, 0, x - 
                                      2, y - 22, SWP_NOZORDER);
        
        collection = ::DeferWindowPos(collection, chatwnd, 0, 1, y - 
                                      20, x - 40, y, SWP_NOZORDER);
            
        if(!::EndDeferWindowPos(collection))
        		return 0;
                
        return 1;
    }
    It has a considerable amount of flickering. I am wondering whether taking control over the messages sent, optimizations, or subclassing would help this problem.

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    The flickering could be caused by overlapping controls, or the parent window drawing the background first, then the controls drawing over the background. Try giving the parent window the WS_CLIPCHILDREN style, and giving the controls WS_CLIPSIBLINGS.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,655
    if that doesn't work, try returning true from WM_ERASEBKGND messages...

  4. #4
    ... arjunajay's Avatar
    Join Date
    May 2005
    Posts
    203

  5. #5
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Word.

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  2. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  3. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 10:06 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21