Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - PNG Toolbar images are showing too small
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

PNG Toolbar images are showing too small

 Post Reply Post Reply
Author
Message
evoX View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 July 2007
Status: Offline
Points: 207
Post Options Post Options   Thanks (0) Thanks(0)   Quote evoX Quote  Post ReplyReply Direct Link To This Post Topic: PNG Toolbar images are showing too small
    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 !
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: 28 October 2008 at 4:51pm

Hi,

paste IDR_TOOLBAR resource from rc file here.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
evoX View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 July 2007
Status: Offline
Points: 207
Post Options Post Options   Thanks (0) Thanks(0)   Quote evoX Quote  Post ReplyReply Direct Link To This Post 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
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: 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
Back to Top
evoX View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 July 2007
Status: Offline
Points: 207
Post Options Post Options   Thanks (0) Thanks(0)   Quote evoX Quote  Post ReplyReply Direct Link To This Post 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 !
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: 29 October 2008 at 4:06pm

ok :)

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.160 seconds.