Announcement

Collapse
No announcement yet.

How to redraw in WM_SIZE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to redraw in WM_SIZE

    Guys --
    I have SDK sizeable window (WS_CLIPCHILDREN) with toolbar, statusbar etc.
    In WM_SIZE I resize all children.
    Finally all redrawn correctly, but a process is not nice.
    For example, when I increase width (right side) is visible "empty place" in toolbar and status bar area.
    A reason is clear - processing ERASEBKGND requires about 0.02-0.1 sec on my PC.

    I tried to redraw toolbar/statusbar at first (using Invalidate/UpdateWindow; RedrawWindow).
    But nothing changed. Should be another way - for example, PB/IDE, Netscape, Outlook Express have no similar defect.
    Any ideas ?

    (BTW, skeleton has a defect - add clipchildren and you will understand, about what I am talking; better to run in Win2000, because 9x is faster)



    ------------------
    E-MAIL: [email protected]

  • #2
    Is hard to know why. MDI? In any event, I have found two things can
    affect things bad/god, and that is window's class style and background
    brush. Sometimes better to not set any style, or use null brush, etc..

    For own MDI editor, finally found that if main window has style
    %CS_DBLCLKS OR %CS_HREDRAW OR %CS_VREDRAW OR %CS_BYTEALIGNWINDOW
    and client has no style at all set, redraw became really smooth.
    No generic solution though - all depends on styles in child controls.
    In another app', not setting any style to main window gave best effect..

    Another thing that may be worth doing, is simple DoEvents in WM_SIZE.
    When and where is hard to say, but maybe resize toolbar, then PeekMessage
    and finish off with complicated drawing.


    ------------------

    Comment


    • #3
      Borge,

      Did you mean Bad/God or Good/God

      ------------------

      Comment


      • #4
        He, yeah well - sometimes God can be bad to us, but usually (s)he is
        good in some mysterious way, so meant to say goood..

        Strange English language is not good though - always so confusing..


        ------------------

        Comment


        • #5
          What about using WM_SIZING?
          Best regards
          Jules
          www.rpmarchildon.com

          Comment


          • #6
            Thanx for suggestions.
            Window has %CS_HREDRAW OR %CS_VREDRAW - anyway it's necessary to redraw.
            I played with PeekMessage and WM_SIZING - no effect.
            Decided to place drawing of background in WM_PAINT instead of WM_ERASEBKGND.
            Now toolbar/statusbar are redrawn first, but not nice view remains - now problems in cenral part (dark bitmap background).
            Maybe in another OSes a view will be better - GDI in Win2000 is slowly than in 9x.



            ------------------
            E-MAIL: [email protected]

            Comment


            • #7
              Here's how I do it in an MDI frame window window proc when I need to resize the MDI client and the status window:
              (Statusbar height is a STATIC)

              Code:
                        CASE %WM_SIZE
                              IF wParam <> %SIZE_MINIMIZED THEN
                                 GetClientRect hWnd, Rect
                                ' and move the client to fit the frame
                                  MoveWindow hWndClient, _
                                      Rect.nLeft, _
                                      Rect.nTop, _
                                      Rect.nRight - Rect.nLeft, _
                                      Rect.nBottom - Rect.nTop - StatusbarHeight, _
                                     %TRUE
                                                                       ' do not EXIT FUNCTION!
                            END IF
                            SendMessage hStatus, wMsg, wParam, lParam   ' will automatically put status window on bottom (style is set this way)
                            FUNCTION = 0: EXIT FUNCTION    ' added 9/07/01
              MCM

              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                How about %WM_SETREDRAW?, In psuedo code...

                WM_SETREDRAW mainWnd, 0
                Size child windows, etc.
                WM_SETREDRAW mainWnd, 1
                InvalidateRect mainWnd
                UpdateWindow mainWnd

                ------------------
                Kev G Peel
                KGP Software, Bridgwater, UK.
                mailto:[email protected][email protected]</A>
                kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

                Comment


                • #9
                  Kev --
                  I already tested WM_SETREDRAW during experiments - nothing.
                  BTW, I ran a program under 98 SE and once again saw great difference in re-painting speed.


                  ------------------
                  E-MAIL: [email protected]

                  Comment

                  Working...
                  X