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

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


Large tool bar buttons

Eric Marc Loebenberg -- loebenbe@qc.bell.ca
Monday, September 30, 1996

Environment: MSVC 4.2, Windows 95

I have two sets of toolbar buttons, small and large.
When I switch from small to large, the large are runcated to the height of
the small toolbar.
When I switch from large to samll, the toolbar height remains large and
the small buttons are displayed.


- I am using .... 
  SetSizes(sizeButton, sizeImage);
  SetHeight(sizeButton.cy+10);
  LoadBitmap(nToolBar);
  Invalidate();

- When I click anywhere on the toolbar, it then correctly displays the
toolbar
  height

Can anyone tell me what I have to do to get the toolbar properly refreshed
after loading
the smaller or larger bitmap?
 
***************************************************************
  Eric Marc Loebenberg                  loebenbe@qc.bell.ca
  Bell Sygma Inc.                    
  700 de la Gauchetiere West       Tel: 514-870-0465
  Room 14W1                        Fax: 514-870-7583
  Montreal, Quebec, Canada
  H3B 4L1



Lars Heucke -- larsmaic@cs.tu-berlin.de
Wednesday, October 02, 1996

[Mini-digest: 3 responses]

Environment: MSVC 4.2, Windows 95

>I have two sets of toolbar buttons, small and large.
>When I switch from small to large, the large are runcated to the height of
>the small toolbar.
>When I switch from large to samll, the toolbar height remains large and
>the small buttons are displayed.


Maybe you can solve it like this:
(I had the same problem, and for my application it works at this way best)

* Create Two TOOLBAR-RESOURCES (not just a BITMAP).
 
* Load them both at CMainFrame::OnCreate with
CToolBar wndToolBarSmall;
m_wndToolBarSmall.Create(this,ToolBarStyle,AFX_IDW_TOOLBAR));
m_wndToolBarSmall.LoadToolBar(IDR_TOOLBARSMALL);
DockControlBar(&m_wndToolBarSmall);

* and then HIDE or SHOW the TOOLBAR you want, in the way like
m_wndToolBarLarge.ShowWindow(SW_NORMAL);
m_wndToolBarSmall.ShowWindow(SW_HIDE);
RecalcLayout();

In this way you have no problems with the repainting of the bars

Hope this help...LARS

------------------------------------------------------------
From:
Lars Heucke
Grossgoerschenstr. 6
10827 Berlin

Phone: ++49 (0)30 787 021 66
Fax:     ++49 (0)30 787 021 68
Scall:   01681 1398891
e-mail: larsmaic@cs.tu-berlin.de
------------------------------------------------------------


-----From: "Erik Funkenbusch" 

Are you calling RecalcLayout()?

-----From: Mario Contestabile

Perhaps 
GetParentFrame()->RecalcLayout();
would help.
If not, perhaps
AfxGetApp()->OnIdle(-1);
will do the trick.

mcontest@universal.com

P.s. Tell Bell my bill payment is in the mail...




James Durie -- james@apiltd.demon.co.uk
Thursday, October 03, 1996

[Mini-digest: 2 responses]

Eric Marc Loebenberg wrote:
> 
> Environment: MSVC 4.2, Windows 95
> 
> I have two sets of toolbar buttons, small and large.
> When I switch from small to large, the large are runcated to the height of
> the small toolbar.
> When I switch from large to samll, the toolbar height remains large and
> the small buttons are displayed.
> 
> - I am using ....
>   SetSizes(sizeButton, sizeImage);
>   SetHeight(sizeButton.cy+10);
>   LoadBitmap(nToolBar);
>   Invalidate();
> 
> - When I click anywhere on the toolbar, it then correctly displays the
> toolbar
>   height
> 
> Can anyone tell me what I have to do to get the toolbar properly refreshed
> after loading
> the smaller or larger bitmap?
> 
> ***************************************************************
>   Eric Marc Loebenberg                  loebenbe@qc.bell.ca
>   Bell Sygma Inc.
>   700 de la Gauchetiere West       Tel: 514-870-0465
>   Room 14W1                        Fax: 514-870-7583
>   Montreal, Quebec, Canada
>   H3B 4L1

I have a little toolbar app in which i do this also and the
documentation states that you cannot dynamically switch button or bitmap
sizes after you have loaded a bitmap.
You must destroy the toolbar and recreate it.

You could experiment with just destroying the underlying windows control
create a new one and then attach it to your class.

-- 
James Durie                     | Atlas Products International Ltd,
(james@apiltd.demon.co.uk)      | Quay West, Trafford Wharf Road,
"Smile, It's Tate & Lyle"       | Manchester, M17 1HH, England.
             - Gary Rhodes      | +44 161 872 2022, Fax +44 161 872 2024
Disclaimer: The views represented here are mine and not those of Atlas
Products International Ltd.
-----From: pxc@kid01pml.icl.co.uk (Paul Cook)


> >I have two sets of toolbar buttons, small and large.

I was dredging thro toolbar code a few days ago, and I think the Wordpad 
sample supports large and small buttons.  You could give it a look in
samples\mfc\ole\wordpad I think.

HTH
Paul.
---
      o o o o o o . . .   ________________________ _________________________
    o      _____          ||Paul Cook            | ||pxc@kid01pml.icl.co.uk|
  .][__n_n_|DD[  ====___  ||Process Solutions    | ||+44 (0)1782 794742    |
 >(________|__|_[_______]_||ICL__________________|_||______________________|_
 _/oo OOOOO oo`  oo  oo   'o^o                o^o` 'o^o                 o^o`
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-




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