Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - how to add an image to toolbar ?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

how to add an image to toolbar ?

 Post Reply Post Reply
Author
Message
lovelypp View Drop Down
Groupie
Groupie


Joined: 17 January 2008
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote lovelypp Quote  Post ReplyReply Direct Link To This Post Topic: how to add an image to toolbar ?
    Posted: 25 September 2010 at 10:27am
I want to display a Image (for example a led light) on the toolbar.
I have added a bmp resource (its id is IDB_RED_LED).
How?
thanks!
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 27 September 2010 at 7:36am
Hi,

you want to stretch it ? check CustomThemes sample - it shows how to override paintmanagers for such things.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lovelypp View Drop Down
Groupie
Groupie


Joined: 17 January 2008
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote lovelypp Quote  Post ReplyReply Direct Link To This Post Posted: 29 September 2010 at 12:25am

We want to display a led-on or a led-off (light) picture on the toolbar area.  which just is a picture and not clickable.  it's well if it can be stretched.

how?
thanks
Back to Top
lovelypp View Drop Down
Groupie
Groupie


Joined: 17 January 2008
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote lovelypp Quote  Post ReplyReply Direct Link To This Post Posted: 14 October 2010 at 8:04pm
I use the following code:
 // Create ToolBar
 CXTPToolBar* pToolBar = (CXTPToolBar*)pCommandBars->Add(_T("标准工具栏"), xtpBarTop);
 if(!pToolBar || !pToolBar->LoadToolBar(IDR_MAINFRAME))
 {
  TRACE0("Failed to create toolbar\n");
  return -1;
 }
 m_wndLed.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_BITMAP | SS_CENTERIMAGE, CRect(0, 0, 16, 16), this);
 CXTPControlCustom* pLedControl = CXTPControlCustom::CreateControlCustom(&m_wndLed);
 pToolBar->GetControls()->Add(pLedControl);
where m_wndLed is of CBitmapPicture from codeguru which support transparent.
 
now the image is added correctly, but does not display correctly. see the following image:
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 15 October 2010 at 12:42am
Hi,

Try CXTPControlLabel instead. 

Set its ID to some ID_LED and set this bitmap to imagemaanger of CommandBars.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.