Customizing CStatusBar - Minimum Height Problem
John Horton -- jhorton@unitechsys.com
Tuesday, April 16, 1996
This is a VC4.0 NT3.51 question.
How can I change the height of a CStatusBar?
MFC technote and help files say to use the CStatusBarCtrl function
SetMinHeight. But it doesn't seem to work for me.
What I want to do is draw a 16x16 pixel bitmap on the status bar. The
status bar height defaults to 14 pixels, presumably because of the
font used. I have the code working, just that the height is wrong.
Here is some code from CMainFrame::OnCreate
...
m_wndStatusBar.GetStatusBarCtrl().SetText(NULL, 1, SBT_OWNERDRAW);
int nWidths[3];
m_wndStatusBar.GetStatusBarCtrl().GetBorders(nWidths);
m_wndStatusBar.GetStatusBarCtrl().SetMinHeight(16 + nWidths[1]*2);
...
Also, the doc is conflicting about the use of SetMinHeight. I'm not
sure whether to include the vertical border widths or not.
Thanks.
Paul Reavley -- reavley@daedalus.com
Thursday, April 18, 1996
In order to use a status bar which allows 2 lines of text I derive a class
from CStatusBar. I overide CalcFixedLayout() to customize my status bar
height. Maybe there is simpler solution that addresses just your question.
> How can I change the height of a CStatusBar?
...
> Also, the doc is conflicting about the use of SetMinHeight. I'm not
> sure whether to include the vertical border widths or not.
Paul Reavley
The Daedalus Group
Tommy Hui -- thui@slip.net
Monday, April 22, 1996
In the latest issue of Microsoft Systems Journal, it mentioned that to
change the height of the status bar is dependent on the font it uses.
Therefore to increase the height of the status bar, create a bigger font for
it to use.
Tommy
At 09:02 AM 4/16/96 -0600, John Horton wrote:
> This is a VC4.0 NT3.51 question.
>
> How can I change the height of a CStatusBar?
>
> MFC technote and help files say to use the CStatusBarCtrl function
> SetMinHeight. But it doesn't seem to work for me.
>
> What I want to do is draw a 16x16 pixel bitmap on the status bar. The
> status bar height defaults to 14 pixels, presumably because of the
> font used. I have the code working, just that the height is wrong.
>
> Here is some code from CMainFrame::OnCreate
>
> ...
> m_wndStatusBar.GetStatusBarCtrl().SetText(NULL, 1, SBT_OWNERDRAW);
> int nWidths[3];
> m_wndStatusBar.GetStatusBarCtrl().GetBorders(nWidths);
> m_wndStatusBar.GetStatusBarCtrl().SetMinHeight(16 + nWidths[1]*2);
> ...
>
> Also, the doc is conflicting about the use of SetMinHeight. I'm not
> sure whether to include the vertical border widths or not.
>
> Thanks.
>
>
| Вернуться в корень Архива
|