Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - how to set icon/png to an button
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

how to set icon/png to an button

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


Joined: 04 January 2008
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote himanshu Quote  Post ReplyReply Direct Link To This Post Topic: how to set icon/png to an button
    Posted: 06 March 2008 at 2:20am
I am working on a ribbonbar application wherein i have different tabs inside it
 
Each tab contains xtpControlButton inside it
 
I want to set a png file for each one of them .How could i load them at runtime.
 
I have not included it inside the .rc file
 
Thanks in advance
Himanshu
Back to Top
himanshu View Drop Down
Groupie
Groupie


Joined: 04 January 2008
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote himanshu Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2008 at 12:53am
hi
 
any solution to this?
Back to Top
himanshu View Drop Down
Groupie
Groupie


Joined: 04 January 2008
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote himanshu Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2008 at 4:59am
in the ribbonbar sample example pngs are loaded using below

UINT uiGroupFind[] = {ID_EDIT_FIND, ID_EDIT_REPLACE, ID_EDIT_GOTO, ID_EDIT_SELECT};

pCommandBars->GetImageManager()->SetIcons(ID_GROUP_FIND, uiGroupFind, _countof(uiGroupFind), CSize(16, 16));

 

what if i have not added this png to resource file.

I want some other method which will load this png file given the full path of this file on the disk.
Any method which will take the file path as argument. 
 
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: 07 March 2008 at 3:17pm

Hi,


1. HBITMAP AFX_CDECL CXTPImageManagerIcon::LoadBitmapFromFile(LPCTSTR lpszFileName, BOOL* lbAlphaBitmap) to load bitmap
2. GetImageManager()->SetIcons(..) to  add it to imagemanager.
3. DeleteObject to destroy
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
himanshu View Drop Down
Groupie
Groupie


Joined: 04 January 2008
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote himanshu Quote  Post ReplyReply Direct Link To This Post Posted: 10 March 2008 at 4:09am
hi
 
thanks..
 
what do the BOOL*lbAlphaBitmap do by default it is null
how to set it to some different value as for lbAlphaBitmap=0 image is shown as black and white
Back to Top
himanshu View Drop Down
Groupie
Groupie


Joined: 04 January 2008
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote himanshu Quote  Post ReplyReply Direct Link To This Post Posted: 10 March 2008 at 4:10am
hi
 
what is the use of lbAlphaBitmap.
LoadBitmapFromFile(LPCTSTR lpszFileName, BOOL* lbAlphaBitmap=0)
by default images is shown as black and white .how to set it to different value
Back to Top
himanshu View Drop Down
Groupie
Groupie


Joined: 04 January 2008
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote himanshu Quote  Post ReplyReply Direct Link To This Post Posted: 10 March 2008 at 4:12am
hi
 
what is the use of lbAlphaBitmap.
LoadBitmapFromFile(LPCTSTR lpszFileName, BOOL* lbAlphaBitmap=0)
by default images is shown as black and white .how to set it to different value
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: 10 March 2008 at 4:30am
Just set it to NULL.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
himanshu View Drop Down
Groupie
Groupie


Joined: 04 January 2008
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote himanshu Quote  Post ReplyReply Direct Link To This Post Posted: 18 March 2008 at 7:01am
how to set it to some  value other than NULL
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: 19 March 2008 at 8:27am

I need same to check what you do.

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