Solved

TControlbar Painting Problem...

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

705 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

18 Experts available now in Live!

Get 1:1 Help Now