Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Objective: Add a bitmap to a button already in a Panel within a Catagory contained in a MFCRibbonBar.

I am doing the following:

1. Open the ribbon bar editor from the Resource View.
2. Right click the button and then select "Properties".
3. On the "Properties" drop-down, click the ellipsis button on the "Image Index" line (shows -1)
4. This then opens the "Image Collection" dialog box.

Questions:
a. Am I correct in assuming that the box with the red diagonal line in it and -1 under it is meant to indicate no images in the collection?
b. I have the images (bitmaps) drawn. How do I get them into the "Image Collection" dialog box so that I can select them?

Is there a toolbar button or menu item for doing this?

Thanks,

Barry
Posted
Updated 20-Jan-12 5:31am

1 solution

In the ribbon editor, click on a category tab. In its properties there are two values:

Large Images (32*32)
Small Images (16*16).

The one that usually counts is large images.
You must have a resource with a bitmap of height = 32 and width = 32 * numimages where the images are stored secuentially.

VERY IMPORTANT: That bitmap must be a 32bit bitmap.
 
Share this answer
 
Comments
BarryPearlman 21-Jan-12 15:05pm    
Thanks, that got me started and I now hae a button with a bitmap struck on it. I have two more questions.

1. The button ascts as if it is DISABLED. Do I have to tell it that it IS ACTIVE? If so, somewhere in the Ribbon Bar editor, or by code?

2. The button that the bitmap is attached to does not seem to recognize a mask. Background is RGB(0, 0, 0). What did I miss>

Thanks again,

Barry
ErnestoNet 21-Jan-12 16:27pm    
OK.
1. To enable the button you must add code in the CMainFrame. In the message map add: ON_COMMAND(ID_BUTTON, &CMainFrame::ProcButton). And add ProcButton procedure as well.



ErnestoNet 21-Jan-12 16:28pm    
Mask is enabled adding code in CMainFrm. Something like:

m_wndRibbonBar.GetCategory(0)->GetLargeImages().SetTransparentColor(RGB(0,0,0));
BarryPearlman 22-Jan-12 12:17pm    
Ernesto -

First of all, you are the first person I have ever communicated with from your part of the world. Thanks for all of the help so far.

I have found the problem - as stated earlier in this thread, the bitmap must be 32 bit. I confirmed this by changing my ImageList back to IDB_FILELARGE and things work as they should, however not the right images.

Question now is, what editor do I use to create 32 bit bitmaps? The one that is internal to Visual Studio 10 will not let me save it any larger than 24 bit. If I try to modify IDB_FILELARGE, the tools are greyed out.

I can draw an image list in the "external editor" (MS Paint); it does not have the option of saving it as 32 bit. Do I have to modify or renamr IDB_FILELARGE in Paint, then create the images I want?

Thanks,

Barry
ErnestoNet 22-Jan-12 15:06pm    
The utility I use is PixelFormat:
http://www.qualibyte.com/pixelformer/

I have an article, here on CodeProject, that uses the ribbon and has some images.
http://www.codeproject.com/Articles/278316/BasicAdmin2-Personal-finance-software

About images, I usually use:
http://commons.wikimedia.org/wiki/Crystal_Clear

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900