15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Status Bar problems

Praful -- ppraf@m-net.arbornet.org
Tuesday, January 14, 1997

Environment: WinNT 4.0, MSVC++ 4.0.
I am unable to increase the size of status bar. I want to increase the height of
 status bar . GetWindowRect() for a status bar does not give correct values.
In the OnCreate() of my class derived frrom CStatusBar, I tried calling GetWindo
wRect() and MoveWindow(). But it does not work.
In the Precreatewindow() of my status bar, I tried changing the data members of
CreateStruct structure. But still I could not increase the height of my status b
ar.
Is there any way of changing the height of status bar??



Dinesh Jindal -- dinesh@XOX.com
Thursday, January 16, 1997

[Mini-digest: 6 responses]

You may use statusBar->GetStatusBarCtrl() to retrieve CStatusBarCtrl
object and then call SetMinHeight() on that object to change the height.
Alternatively, you may effect the increase in height of status bar by 
changing the font being used by status bar. Just create a bigger font
and call SetFont(). This I haven't tried with VC4.x, but I remember
using something like this in ver 1.5 days.

About GetWindowRect() on Status bar, I am not sure if it'll work right.
Instead you may use GetItemRect() to get the size of a particular item
on the status bar ( in any case height of all items is same).
The other way to get the size is to call CalcFixedLayout() or 
CalcDynamicLayout() function on CstatusBar. These two functions are the
members of base class CControlBar.

BTW, all this is clearly documented in online help for VC++.

Happy Trails...
Dinesh Jindal.


Praful wrote:
> 
> Environment: WinNT 4.0, MSVC++ 4.0.
> I am unable to increase the size of status bar. I want to increase the height of
>  status bar . GetWindowRect() for a status bar does not give correct values.
> In the OnCreate() of my class derived frrom CStatusBar, I tried calling GetWindo
> wRect() and MoveWindow(). But it does not work.
> In the Precreatewindow() of my status bar, I tried changing the data members of
> CreateStruct structure. But still I could not increase the height of my status b
> ar.
> Is there any way of changing the height of status bar??

-----From: dima@ssm6000.samsung.ru (Dulepov Dmitry)

        [Mailer: "Groupware E-Mail". Version 1.02.054]

>        [From: Praful

>I am unable to increase the size of status bar. I want to increase the height of
> status bar . GetWindowRect() for a status bar does not give correct values.
>In the OnCreate() of my class derived frrom CStatusBar, I tried calling GetWindo
>wRect() and MoveWindow(). But it does not work.
>In the Precreatewindow() of my status bar, I tried changing the data members of
>CreateStruct structure. But still I could not increase the height of my status b
>ar.
>Is there any way of changing the height of status bar??

1. Even if you set values in 'CreateStruct', they are ignored. CStatusBar::Create() creates a status bar with zero width and height.
2. Size of status bar changed in the response to WM_SIZEPARENT message (sent by CWnd::RepositionBars() function).


Dmitry A. Dulepov
Samsung Electronics Co., Ltd.
Russian Research Center
Phone: +7 (095) 213-9207
Fax: +7 (095) 213-9196
E-mail: dima@src.samsung.ru
====================================

-----From: Mike Blaszczak 

At 23:11 1/14/97 -0500, Praful wrote:
>Environment: WinNT 4.0, MSVC++ 4.0.

>I am unable to increase the size of status bar. I want to increase the
height of
> status bar . GetWindowRect() for a status bar does not give correct values.

Of course it does.  It won't if you call it at the wrong time, but it does
work correctly when applied correctly.

>In the OnCreate() of my class derived frrom CStatusBar, I tried calling
GetWindo
>wRect() and MoveWindow(). But it does not work.
>In the Precreatewindow() of my status bar, I tried changing the data
members of
>CreateStruct structure. But still I could not increase the height of my
status
>bar.

The bar is initially created by MFC with a zero size, and then laid out later.

>Is there any way of changing the height of status bar??

Yes.  Read up on how frame windows and views and control bars participate in
their dynamic layout.  Since CScrollBar derives form CControlBar, you can
derive
your own class and override CalcFixedLayout() and CalcDynamicLayout() to
affect
the way the bar ends up telling the form window about its size.  You need to
change those resutls.



.B ekiM
http://www.nwlink.com/~mikeblas/
Why does the "new" Corvette look like a 1993 RX-7?
These words are my own. I do not speak on behalf of Microsoft.

-----From: Neil Dixon 



>------------
>>From: 	Praful[SMTP:ppraf@m-net.arbornet.org]
>>Sent: 	Wednesday, January 15, 1997 4:11 AM
>>To: 	mfc-l@netcom.com
>>Subject: 	Status Bar problems
>
>>Environment: WinNT 4.0, MSVC++ 4.0.
>>I am unable to increase the size of status bar. I want to increase the
>>height of
>> status bar . GetWindowRect() for a status bar does not give correct values.
>>In the OnCreate() of my class derived frrom CStatusBar, I tried calling
>>GetWindo
>>wRect() and MoveWindow(). But it does not work.
>>In the Precreatewindow() of my status bar, I tried changing the data members
>>of
>>CreateStruct structure. But still I could not increase the height of my
>>status bar.
>>Is there any way of changing the height of status bar??
----------
The following oversimplified ( but working ) derived status bar does
what I think you want it to

// Header file

class CMyStatusBar : public CStatusBar
{
protected:
	DECLARE_MESSAGE_MAP()

	afx_msg void OnSize( UINT nType, int cx, int cy );

};

// Cpp file

#include "stdafx.h"
#include "mystatusbar.h"

BEGIN_MESSAGE_MAP(CMyStatusBar, CStatusBar )
	ON_WM_SIZE()
END_MESSAGE_MAP()

void CMyStatusBar::OnSize( UINT nType, int cx, int cy )
{
	m_nMinHeight = 100; // this is the magic bit use your height here
	CStatusBar::OnSize( nType, cx, cy );
}

// end of example code

the "m_nMinHeight" protected member of CStatusBar is used by the MFC
code.
To see how this all works look in BARSTAT.CPP in the MFC source.

Hope this helps
Neil Dixon
--
neildixon@enterprise.net
NADixon@rce.ricardo.com

-----From: "Dean Wiles" 

The help for "Status Windows / Size and Height" reads:

An application can set the minimum height of a status window's drawing area
by sending the window an SB_SETMINHEIGHT message, specifying the minimum
height, in pixels. The drawing area does not include the window's borders.
A minimum height is useful for drawing in an owner-drawn status window. For
more information about owner-drawn status windows, see Owner-Drawn Status
Windows. 

You can also look at the CStatusBar implementation code in
\MSDEV\MFC\SRC\BARSTAT.CPP
to get an idea of how it works.

--------------------------------------------------------------------------
Dean Wiles (deanw@mail.isc-br.com)          Olivetti North America
Phone:  (509)927-7037                       22425 East Appleway Ave
Fax:    (509)927-2499                       Liberty Lake, WA 99019-9534
If the Son sets you free, you will be free indeed.  (John 8:36)

----------
> From: Praful 
> To: mfc-l@netcom.com
> Subject: Status Bar problems
> Date: Tuesday, January 14, 1997 8:11 PM
> 
> Environment: WinNT 4.0, MSVC++ 4.0.
> I am unable to increase the size of status bar. I want to increase the
height of
>  status bar . GetWindowRect() for a status bar does not give correct
values.
> In the OnCreate() of my class derived frrom CStatusBar, I tried calling
GetWindo
> wRect() and MoveWindow(). But it does not work.
> In the Precreatewindow() of my status bar, I tried changing the data
members of
> CreateStruct structure. But still I could not increase the height of my
status b
> ar.
> Is there any way of changing the height of status bar??
-----From: KAVITHA SANT 


Just assign the height you need to the variable "m_nMinHeight" in the
Create function of your status bar class.
Probably not the recommended solution but it works (and nothing else
seems to!)

Kavitha.


>----------
>From: 	Praful[SMTP:ppraf@m-net.arbornet.org]
>Sent: 	Wednesday, 15 January, 1997 9:11 AM
>To: 	mfc-l@netcom.com
>Subject: 	Status Bar problems
>
>Environment: WinNT 4.0, MSVC++ 4.0.
>I am unable to increase the size of status bar. I want to increase the height
>of
> status bar . GetWindowRect() for a status bar does not give correct values.
>In the OnCreate() of my class derived frrom CStatusBar, I tried calling
>GetWindo
>wRect() and MoveWindow(). But it does not work.
>In the Precreatewindow() of my status bar, I tried changing the data members
>of
>CreateStruct structure. But still I could not increase the height of my
>status b
>ar.
>Is there any way of changing the height of status bar??
>




| Вернуться в корень Архива |