Announcement

Collapse
No announcement yet.

What is a Frame

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

  • Jules Marchildon
    replied
    Semen;

    Instead of a Child window container and having it parent several
    other controls, why not just paint two non-fill squares, first color
    raised and second color (offset by 1x and 1y) for highlight. You can
    use the label to act as the caption as you already are using. This
    avoids any clipping issue and Frame Erase Background issue. All this
    can be done inside of your paint handler. I think this is the direction
    you are heading anyway.

    (Sorry, just trying to get back into the swing of things again.)

    Jules

    Code:
    '-----------------------------------------------------------------------------
    ' Draw Frame with etched highlight...
    '-----------------------------------------------------------------------------
    FUNCTION  DrawMyFrame( ByVal hDC AS LONG, ByVal x AS LONG, ByVal y AS LONG, ByVal cx AS LONG,ByVal cy AS LONG ) AS LONG
     
        LOCAL rc AS RECT
     
        rc.nLeft   = x
        rc.nTop    = y
        rc.nRight  = x + cx
        rc.nBottom = y + cy
     
        lResutlt& = DrawEdge( hDC,rc,  %EDGE_ETCHED, %BF_RECT)
     
        FUNCTION = lResult&
    END FUNCTION
                  
     '...
      
      
     CASE %WM_PAINT
             hDC = BeginPaint(hWnd, ps)
             '---
             DrawMyFrame hDC, 200,10,200,200
             '---
             szInfo = Str$(nCount)
             hOldFont& = SelectObject(hDC, GetStockObject(%SYSTEM_FIXED_FONT))
             SetBkMode hDC,%TRANSPARENT
             SetTextColor hDC, RGB(255,0,0)
             TextOut hDC, 280 , 100 , szInfo, LEN(szInfo)
             SelectObject hDC,hOldFont&
             ReleaseDC hWnd, hDC
             EndPaint hWnd,ps

    [This message has been edited by Jules Marchildon (edited April 06, 2001).]

    Leave a comment:


  • Aldo Cavini
    replied
    Semen, I hope not to annoy you - I already told you about this topics.

    The program I'm working on does the following:

    1- Draws ownerdrawn menu-bar items with custom colors
    2- Draws ownerdrawn buttons inside dialogs with custom colors
    3- Uses bitblt to show bitmaps 8 bit with custom colors

    All these work fine on 256 colors screen. Create a palette and select it into every device context you use. I use this way also inside a beginpaint - endpaint block. One trick: to use brushes load PALETTEINDEX colors (color index OR &H01000000). This is for not to get dithered colors.
    Another obvious trick: you can refuse the default background behavior - on the %WM_ERASEBKGND put FUNCTION = %true and then EXIT FUNCTION. You will paint the background on the WM_PAINT message.

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

    Leave a comment:


  • Semen Matusovski
    replied
    Thanx, guys. I'll cut a code from real program and will post.

    Jules --
    The reason, why I refused from frame (BUTTON, GROUPBOX) is a palette.
    Let's say that background color should be RGB(172, 160, 84).
    If to create SolidBrush and to use in true-color regime, it will be correct color.
    But in 256-colors mode you will see wrong color.

    Unf. it's not possible to create a palette once and to select it into hDC.
    It's necessary to do exactly before drawing operations - between BeginPaint and EndPaint.
    Because this part is hidden, alone way (as I understand) to draw by yourself.


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

    Leave a comment:


  • Jules Marchildon
    replied
    Poof! (now imagine a cloud of smoke)

    [This message has been edited by Jules Marchildon (edited April 06, 2001).]

    Leave a comment:


  • Lance Edmonds
    replied
    Sure, BeginPaint() only.

    Patrice's idea would do exactly what %WS_CLIPSIBLINGS should do for you.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Patrice Terrier
    replied
    Semen

    The solution could be to build a mask on the fly that will match the holes.
    Then paint the background using the mask.


    ------------------
    Patrice Terrier
    mailto[email protected][email protected]</A>

    Leave a comment:


  • Semen Matusovski
    replied
    Lance --
    Probably, yes, but I don't exactly understand, how this style works internally.

    WS_CLIPSIBLINGS
    Clips child windows relative to each other; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not given and child windows overlap, when you draw within the client area of a child window, it is possible to draw within the client area of a neighboring child window.)
    For use with the WS_CHILD style only

    If frame has WS_CLIPSIBLINGS, should I paint using BeginPaint only ?
    Have I right to fill whole client area, for example, in ERASEBKGND ?

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

    Leave a comment:


  • Lance Edmonds
    replied
    Semen, maybe I'm still not clear on what you want... does %WS_CLIPSIBLINGS not fill this void?

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Semen Matusovski
    replied
    Jules --
    I need to understand, how to prevent filling areas, which belong to windows inside frame.
    Just now I fill whole client area and this works in current program, because I located Control Add in certain order.
    But clear, it's not a good solution.

    Probably, easiest solution is to build a region. What do you do ?




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

    Leave a comment:


  • Jules Marchildon
    replied
    Semen;

    Show me what you need. I spent about 8 months working with Frames of
    sorts maybe I can offer you something.

    Regards,
    Jules

    --------------------------
    EMAIL: [email protected]

    Leave a comment:


  • Aldo Cavini
    replied
    Semen,

    When changing the text you need to redraw the top line only. I think this will not be as slower as a complete frame redrawing. You can redraw the text and the line for the space left free. If the text is longer, you will not see the flicker at all. If it is shorter the line drawing will overlap the old text - I think you will not see the flicker too.

    Another solution: to draw the text in such a way you must not redraw the lines. I mean, a text that is above the lines.

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

    Leave a comment:


  • Semen Matusovski
    replied
    Guys --
    remember Tab-Control (which also confuses me). It and pages are childs of the same parent.

    If to declare textboxes, labels and , placed on frame, as child of this frame - here all is clear and exactly there are no troubles and it's possible and necessary to update whole client area.
    But I don't like this way.

    Lines with label ... In program I permanently change a title (and it's length). To re-create windows is not nice for performance + flickering.

    [This message has been edited by Semen Matusovski (edited April 04, 2001).]

    Leave a comment:


  • Aldo Cavini
    replied
    Borje,

    I know it (it is explained in the Win32Api.Hlp - CreateWindow) - I use this flag when I create my dialog boxes via DialogBoxIndirect). I can't understand why a frame is considered a button instead of a static control. May be I miss some information... or this is only one of the many Windows's mysterious ways.

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



    [This message has been edited by Aldo Cavini (edited April 04, 2001).]

    Leave a comment:


  • Borje Hagsten
    replied
    Looking in Spy++, a Frame is a "Button" with BS_GROUPBOX style.

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

    Leave a comment:


  • Aldo Cavini
    replied
    Semen,

    may be it is a stupid suggestion, but why don't you substitute the frame with a label and a few lines? I've read in MSDN there can be some problems with frames (as I remember in Windows CE the frame must be drawn after che childs and not before ... or vice-versa?).

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


    [This message has been edited by Aldo Cavini (edited April 04, 2001).]

    Leave a comment:


  • Semen Matusovski
    started a topic What is a Frame

    What is a Frame

    Because of palette, I decided to write "replacements" for label & Frame.
    With first was very simple (de-facto, simple TextOut), but Frame confuses me.

    The easiest solution - to FillRect whole client area and then to draw.
    But inside frame are located another childs.

    As I understand, if to create a "frame" first and then other childs, redrawing will be correct.

    Better to avoid filling "internals" of frame.
    Guys, any ideas, how to do this (without regions) ?

    (BTW, somehow demonstrated advantages of WS_EX_TRANSPARENT; probably, this way ?)

    ------------------
    E-MAIL: [email protected]
Working...
X