Solved

TControlbar Painting Problem...

Posted on 1998-06-04
5
345 Views
Last Modified: 2013-12-26
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
Comment
Question by:djfr
  • 2
  • 2
5 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1299690
Which version of OWL are you using?
0
 

Author Comment

by:djfr
ID: 1299691
BC++ 5.02, OWL 5.0

DJF
0
 
LVL 3

Accepted Solution

by:
JPM earned 200 total points
ID: 1299692
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
 

Author Comment

by:djfr
ID: 1299693
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
 
LVL 3

Expert Comment

by:JPM
ID: 1299694
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

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question