Print Page | Close Window

how to add an image to toolbar ?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=17324
Printed Date: 11 May 2025 at 12:55am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: how to add an image to toolbar ?
Posted By: lovelypp
Subject: how to add an image to toolbar ?
Date 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!



Replies:
Posted By: Oleg
Date 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


Posted By: lovelypp
Date 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


Posted By: lovelypp
Date 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:


Posted By: Oleg
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net