SetWindowRgn kills XP themes??? OR How to BLOCK redraw... - Programmer

This is a discussion on SetWindowRgn kills XP themes??? OR How to BLOCK redraw... - Programmer ; Ok, here is the situation... I've got some unavoidable "resizing / layouting" issues... ie.. ugly repainting... not really much I can do about those issues... most windows/mfc apps have them... I was able to "hide" them by turning off window ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: SetWindowRgn kills XP themes??? OR How to BLOCK redraw...

  1. SetWindowRgn kills XP themes??? OR How to BLOCK redraw...

    Ok, here is the situation...

    I've got some unavoidable "resizing / layouting" issues... ie.. ugly
    repainting... not really much I can do about those issues... most
    windows/mfc apps have them...

    I was able to "hide" them by turning off window repainting on the main
    window at key times... but doing so has had side effects... I've spent two
    days try to find a solution...

    1) SetRedraw(FALSE) / SetRedraw(TRUE) / RedrawWindow() doesn't work to well
    since it doesn't stop painting in child windows

    2) LockWindowUpdate() / UnlockWindowUpdate() work as advertised, but we all
    know the problem with those functions... if too many repaints go on while
    the window is locked, you get ugly screen flashes when you unlock... I'm
    being a good citizen and only locking my CMainFrame (although I've tried
    locking the desktop too).

    3) Now my latest solution...

    CRgn rgn;
    rgn.CreateRectRgn(0, 0, 0, 0);
    SetWindowRgn((HRGN)rgn.m_hObject, FALSE);
    // do the stuff
    SetWindowRgn((HRGN)NULL, TRUE);

    This also works as advertised, and with none of the flicker associated with
    LockWindowUpdate()...

    Problem with this one, is if the developer (user of my DLL library) has set
    a custom window rgn, they loose it because I am clearing it for them...

    So again, I try to be a good citizen by saving the current window rgn...

    HRGN hRgn = CreateRectRgn(0, 0, 0, 0);
    GetWindowRgn(hRgn);
    // set empty region
    // do the stuff
    SetWindowRgn(hRgn);

    I'm reseting the region that the window had before my function was called...
    well, whoopty-doo... it works...

    except when the developer didn't have a custom region... the frame for some
    reason looses its XP theming... but maintains its rounded corners... even in
    classic mode...

    OR

    when setting regions and specifying DONT repaint... it decides to repaint
    anyways... and I get an ugly effect where parts of windows underneath show
    through...



  2. Re: SetWindowRgn kills XP themes??? OR How to BLOCK redraw...


    "Nobody" wrote in message
    news:_yvfg.178227$bm6.150719@fed1read04...
    > Ok, here is the situation...
    >
    > I've got some unavoidable "resizing / layouting" issues... ie.. ugly
    > repainting... not really much I can do about those issues... most
    > windows/mfc apps have them...
    >
    > I was able to "hide" them by turning off window repainting on the main
    > window at key times... but doing so has had side effects... I've spent two
    > days try to find a solution...
    >
    > 1) SetRedraw(FALSE) / SetRedraw(TRUE) / RedrawWindow() doesn't work to
    > well since it doesn't stop painting in child windows
    >
    > 2) LockWindowUpdate() / UnlockWindowUpdate() work as advertised, but we
    > all know the problem with those functions... if too many repaints go on
    > while the window is locked, you get ugly screen flashes when you unlock...
    > I'm being a good citizen and only locking my CMainFrame (although I've
    > tried locking the desktop too).
    >
    > 3) Now my latest solution...
    >
    > CRgn rgn;
    > rgn.CreateRectRgn(0, 0, 0, 0);
    > SetWindowRgn((HRGN)rgn.m_hObject, FALSE);
    > // do the stuff
    > SetWindowRgn((HRGN)NULL, TRUE);
    >
    > This also works as advertised, and with none of the flicker associated
    > with LockWindowUpdate()...
    >
    > Problem with this one, is if the developer (user of my DLL library) has
    > set a custom window rgn, they loose it because I am clearing it for
    > them...
    >
    > So again, I try to be a good citizen by saving the current window rgn...
    >
    > HRGN hRgn = CreateRectRgn(0, 0, 0, 0);
    > GetWindowRgn(hRgn);
    > // set empty region
    > // do the stuff
    > SetWindowRgn(hRgn);
    >
    > I'm reseting the region that the window had before my function was
    > called... well, whoopty-doo... it works...
    >
    > except when the developer didn't have a custom region... the frame for
    > some reason looses its XP theming... but maintains its rounded corners...
    > even in classic mode...
    >
    > OR
    >
    > when setting regions and specifying DONT repaint... it decides to repaint
    > anyways... and I get an ugly effect where parts of windows underneath show
    > through...
    >
    >


    4) Turn on/off the WS_VISIBLE style using SetWindowLong

    James

    --
    Microsoft MVP - Windows SDK
    www.catch22.net
    Free Win32 Source and Tutorials



  3. Re: SetWindowRgn kills XP themes??? OR How to BLOCK redraw...

    Nope, didn't work... that has just about the same effect as WM_SETREDRAW...
    parts of windows underneath flash through.

    "James Brown [MVP]" wrote in message
    news:gfudnSxqd_fiCOPZnZ2dnUVZ8tOdnZ2d@pipex.net...
    >
    > "Nobody" wrote in message
    > news:_yvfg.178227$bm6.150719@fed1read04...
    >> Ok, here is the situation...
    >>
    >> I've got some unavoidable "resizing / layouting" issues... ie.. ugly
    >> repainting... not really much I can do about those issues... most
    >> windows/mfc apps have them...
    >>
    >> I was able to "hide" them by turning off window repainting on the main
    >> window at key times... but doing so has had side effects... I've spent
    >> two days try to find a solution...
    >>
    >> 1) SetRedraw(FALSE) / SetRedraw(TRUE) / RedrawWindow() doesn't work to
    >> well since it doesn't stop painting in child windows
    >>
    >> 2) LockWindowUpdate() / UnlockWindowUpdate() work as advertised, but we
    >> all know the problem with those functions... if too many repaints go on
    >> while the window is locked, you get ugly screen flashes when you
    >> unlock... I'm being a good citizen and only locking my CMainFrame
    >> (although I've tried locking the desktop too).
    >>
    >> 3) Now my latest solution...
    >>
    >> CRgn rgn;
    >> rgn.CreateRectRgn(0, 0, 0, 0);
    >> SetWindowRgn((HRGN)rgn.m_hObject, FALSE);
    >> // do the stuff
    >> SetWindowRgn((HRGN)NULL, TRUE);
    >>
    >> This also works as advertised, and with none of the flicker associated
    >> with LockWindowUpdate()...
    >>
    >> Problem with this one, is if the developer (user of my DLL library) has
    >> set a custom window rgn, they loose it because I am clearing it for
    >> them...
    >>
    >> So again, I try to be a good citizen by saving the current window rgn...
    >>
    >> HRGN hRgn = CreateRectRgn(0, 0, 0, 0);
    >> GetWindowRgn(hRgn);
    >> // set empty region
    >> // do the stuff
    >> SetWindowRgn(hRgn);
    >>
    >> I'm reseting the region that the window had before my function was
    >> called... well, whoopty-doo... it works...
    >>
    >> except when the developer didn't have a custom region... the frame for
    >> some reason looses its XP theming... but maintains its rounded corners...
    >> even in classic mode...
    >>
    >> OR
    >>
    >> when setting regions and specifying DONT repaint... it decides to repaint
    >> anyways... and I get an ugly effect where parts of windows underneath
    >> show through...
    >>
    >>

    >
    > 4) Turn on/off the WS_VISIBLE style using SetWindowLong
    >
    > James
    >
    > --
    > Microsoft MVP - Windows SDK
    > www.catch22.net
    > Free Win32 Source and Tutorials
    >
    >




+ Reply to Thread