• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

TControlbar Painting Problem...

I have a TMIChild container window with 2 Control bars inserted at the top of the window (stacked).  There seems to be an area about 2 pixels wide on the bottom edge of the top control bar that isn't being repainted when the TMDIChild is resized or otherwise covered by another window.  I am increasing the top and bottom margins by 2 in the TControlBar constructor (Margins.Top +=2 and Margins.Bottom +=2).  I have also overridden TControlBar::Paint with the following:

//
// RTMToolBar::Paint(TDC& dc, bool erase, TRect& rect)
//
// This will paint a border between the MenuBar and
// the Toolbar
//
void RTMToolBar::Paint(TDC& dc, bool erase, TRect& rect)
{
      TControlBar::Paint(dc, erase, rect);

        TUIBorder(TRect(0,0,Attr.W,2), TUIBorder::EdgeEtched, TUIBorder::Top).Paint(dc);
}

This code adds an Etched edge to the top of the control bar.

This painting problem seems to exist even if I comment out the edge-painting code or the code that increases the margin size in the contructor.  What can I do?

Darrell Frazier
Manager, Workstation Products
Vendata, Inc.
http://www.vendata.com
djfrazier@vendata.com
0
djfr
Asked:
djfr
  • 2
  • 2
1 Solution
 
Tommy HuiCommented:
Which version of OWL are you using?
0
 
djfrAuthor Commented:
BC++ 5.02, OWL 5.0

DJF
0
 
JPMCommented:
I 've got a similar trouble with a program upgraded from BC4.52 to BC5    ( about a frame )  
I fix up  that pb  when creating an internal border ( or margin )
in the EvEraseBkgnd( HDC hDC)   function
( it 's an odd job but I didn't find a better one  :-)

Hope this helps!

Jean-Paul
0
 
djfrAuthor Commented:
I am sorry I was slow to get back.  I was in Montana for a week.  The proposed answer is kind of vague.  Could your provide some example code?

Darrell Frazier

0
 
JPMCommented:
Hi!
Sorry to be late.....so many things to do...and just 24 hours a day !!!!
The code following  is used  to work around  the same trouble as yours but with a main frame window
////////////////////////////////////////////////////////////////////////////////
bool TMyFrame::EvEraseBkgnd (HDC hDC)
{
    TDC dc(hDC);

  //  getting client area
     TSize clientAreaSize = GetClientRect().Size();
  // getting frame size
     TRect outside = GetWindowRect();
  //  define a  border
     TSize border = outside.Size() - clientAreaSize;
   // define a margin
     TSize marge(2,2);
     int mx = marge.cx * border.cx;
     int my = marge.cy * border.cy;
   // painting an internal frame in gray
     dc.SetBkColor(GetSysColor(COLOR_BTNFACE));
    TRect wr = GetClientRect();
    dc.TextRect(wr.left, wr.top, wr.left+mx, wr.bottom);           // left
    dc.TextRect(wr.left+mx, wr.top, wr.right-mx, wr.top+my);  // top
    dc.TextRect(wr.right-mx, wr.top, wr.right, wr.bottom);         // right
    dc.TextRect(wr.left+mx, wr.bottom-my, wr.right-mx, wr.bottom); // bottom

     return true;      
}
////////////////////////////////////////////////////////////////////////////////
Hope this helps to solve your pb.

Jean-Paul

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now