Print Page | Close Window

PNG Toolbar images are showing too small

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=12554
Printed Date: 23 June 2025 at 6:25pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: PNG Toolbar images are showing too small
Posted By: evoX
Subject: PNG Toolbar images are showing too small
Date Posted: 28 October 2008 at 2:28pm

The images on toolbar are automatically scaled down from 48x48 to 16x16, so I get something like this

the toolbar has 2 buttons (48x48), but both images appear on the first button.

 
This is the toolbar source code:

CXTPCommandBars* pCommandBars = GetCommandBars();

pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAIN_MENU);

CXTPToolBar* pToolBar = pCommandBars->Add(_T("Main"), xtpBarBottom);

if (!pToolBar || !pToolBar->LoadToolBar(IDR_TOOLBAR, FALSE))

{

TRACE0("Failed to create toolbar\n");

return -1;

}

XTPImageManager()->SetIcons(IDR_TOOLBAR, IDB_MAINTOOLBAR);

pCommandBars->SetTheme(xtpThemeOffice2007);

pCommandBars->GetCommandBarsOptions()->szLargeIcons = CSize(48, 48);

pCommandBars->GetCommandBarsOptions()->bLargeIcons = TRUE;

Why the images are not displayed at their original size of 48x48 pixels ?
Thanks !



Replies:
Posted By: Oleg
Date Posted: 28 October 2008 at 4:51pm

Hi,

paste IDR_TOOLBAR resource from rc file here.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: evoX
Date Posted: 28 October 2008 at 6:51pm
IDR_TOOLBAR TOOLBAR  48, 48
BEGIN
    BUTTON      ID_MAIN_EXIT
    BUTTON      ID_MAIN_TEST
END
 
 
...I have also tried with IDR_TOOLBAR TOOLBAR MOVEABLE PURE 48,48 just like in WinZip GUI sample..., but I got the same result. 
 
....and this is the menu
IDR_MAIN_MENU MENU
BEGIN
    POPUP "Main"
    BEGIN
        MENUITEM "E&xit",                       ID_MAIN_EXIT
        MENUITEM "Test",                        ID_MAIN_TEST
    END
END


Posted By: Oleg
Date Posted: 29 October 2008 at 5:09am

Hi,

Looks right.
What size IDB_MAINTOOLBAR bitmap has ?
 
also try step into SetIcons and check how many icons atually set.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: evoX
Date Posted: 29 October 2008 at 6:04am
Hi,
  The PNG bitmap is 288x48 pixels and in debugger SetIcons function loads 2 icons with the size of 48x48
   I have tried a PNG with the size of 96x48 and now the bitmaps are displayed correctly !
   It seems that SetIcons loads the entire bitmap, no matter what size you specify in szLargeIcons and then it just slices the bitmap according to the number of toolbar buttons and then it scales the image to fit in toolbar, very strange behaviour.
   You should specify in documentation or in sample source code as a comment that // The Toolbar bitmap should be the exact size or it won't display correctly.
 
Thanks Oleg !
You have a great supprt !


Posted By: Oleg
Date Posted: 29 October 2008 at 4:06pm

ok :)



-------------
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