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

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


Status Bar

Praful Shenoy -- ppraf@hotmail.com
Friday, February 07, 1997

Problem 1.
I have derived my own class from CStatusBar. I want
to erase the statusbar background and give my own
colour. So I have provided implementation for 
OnEraseBkgnd() as follows:

afx_msg BOOL CWdStatusBar::OnEraseBkgnd( CDC* pDC )
{
CBrush hBrush;
hBrush.CreateSolidBrush( RGB(255, 255, 0));
CRect rect;
GetClientRect(rect);
pDC->FillRect(&rect, &hBrush);
return TRUE;
}

But this code only changes the colour of the statusbar
border.  I donot want to override OnPaint() because then
I have to take care of a lot of other details like 
drawing the panes for the statusbar.
Any suggestions?

Problem 2.
The status bar is displayed with a sizing grip. I would
like to remove the sizing grip. Actually I don't 
want the status bar to be resized. I tried changing 
styles in the Create() of status bar but it does not 
help.
Any Suggestions?

Praful
BFL Software
Bangalore
India

---------------------------------------------------------
Get Your *Web-Based* Free Email at http://www.hotmail.com
---------------------------------------------------------




Mihir Dalal -- m_dalal@ECE.concordia.CA
Sunday, February 09, 1997


                

This is the first time, in my 6 months of membership with the mfc-l mail 
list, that I am seeing a question slipping in WITHOUT the environment 
line heading it.

Unless the environment is specified, it is impossible to post a concrete 
answer.  

Mihir. 

________________________________________________________________________
  Mihir Dalal  M. Engg. (Electrical) Student
            Department of Electrical & Computer Engineering
              Concordia University, Montreal QC CANADA
            http://www.ECE.Concordia.Ca/~m_dalal/addr.html 


On Fri, 7 Feb 1997, Praful Shenoy wrote:

> Problem 1.
> I have derived my own class from CStatusBar. I want
> to erase the statusbar background and give my own
> colour. So I have provided implementation for 
> OnEraseBkgnd() as follows:
> 
> afx_msg BOOL CWdStatusBar::OnEraseBkgnd( CDC* pDC )
> {
> CBrush hBrush;
> hBrush.CreateSolidBrush( RGB(255, 255, 0));
> CRect rect;
> GetClientRect(rect);
> pDC->FillRect(&rect, &hBrush);
> return TRUE;
> }
> 
> But this code only changes the colour of the statusbar
> border.  I donot want to override OnPaint() because then
> I have to take care of a lot of other details like 
> drawing the panes for the statusbar.
> Any suggestions?
> 
> Problem 2.
> The status bar is displayed with a sizing grip. I would
> like to remove the sizing grip. Actually I don't 
> want the status bar to be resized. I tried changing 
> styles in the Create() of status bar but it does not 
> help.
> Any Suggestions?
> 
> Praful
> BFL Software
> Bangalore
> India
> 
> ---------------------------------------------------------
> Get Your *Web-Based* Free Email at http://www.hotmail.com
> ---------------------------------------------------------
> 






Mike Blaszczak -- mikeblas@nwlink.com
Sunday, February 09, 1997

At 03:38 2/7/97 -0800, Praful Shenoy wrote:

>Problem 2.
>The status bar is displayed with a sizing grip. I would
>like to remove the sizing grip. Actually I don't 
>want the status bar to be resized. I tried changing 
>styles in the Create() of status bar but it does not 
>help.

The bar gets a size grip because the window you've put it into
is resizeable.  The size grip is the windows standard UI to show
that the window is resizeable.  The code that does this is right
there in MFC; trace into CStatusBar::Create() and you'll find:

	if (pParentWnd->GetStyle() & WS_THICKFRAME)
		dwStyle |= SBARS_SIZEGRIP;

Since you say that you've already derived your own class for
your style bar, you should be able to override PreCreateWindow()
and filter out the SBARS_SIZEGRIP style. 

On the other hand, I'm not sure I understand how you expect the
status bar to not be resizable without making the parent window
not resizable.  If you don't want the status bar to be resized,
you should make the parent window not resizable--that'll remove
the sizegrip _and_ make the status bar not resizable.


.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
           This performance was not lip-synched.





Become an MFC-L member | Вернуться в корень Архива |