Solved

TControlbar Painting Problem...

Posted on 1998-06-04
5
337 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Xsl Nested Loop 4 28
jQuery Date picker not working 16 128
removing hyperlinks from end-notes in a PDF to HTML conversion 8 92
Swiper slider stops between pages 11 49
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

815 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now