Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtPropertyGridCtrl: how to add a cell that has both a string and a bitmap/icon? Collapse All
Subject Author Date
Eli Kaczer Nov 11, 2005 - 5:46 PM

From the documentation, I found the following:


CExtGridCell::IconIndexSet(), but it wasn’t clear to me on how it is implemented, or if it is what I need to automatically add an image in my cell. 

Eli Kaczer Nov 11, 2005 - 6:15 PM

Actually, I managed to get it to work, but if someone can let me know if this is the appropriate way, I would appreciate it.  Here are the steps that I took:


In my class derived from CExtPropertyGridCtrl, I provide a test function called:


 void LoadIcons()


{



CExtPropertyGridWnd* pGridWnd = GetActiveGrid();


if (NULL != pGridWnd)


{


HICON hIcon = LoadIcon(NULL, IDI_HAND);


CExtCmdIcon icon(hIcon, true);


pGridWnd->GridIconInsert(&icon);


}


}


 


then in my subsequent call to populate a grid cell:


I call the function: CExtGridCell::IconIndexSet() with the desired icon that was populated from above


 

Technical Support Nov 14, 2005 - 3:18 AM

You correctly use icons in grid cells. So, we will just make some remarks below. There are two ways of attaching an icon to the grid cell:

A) Keep a CExtCmdIcon object in the grid cell. This requires you to define a CExtGridCell-derived class and implement the CExtGridCell::IconGet() virtual method in it. But it is not good if in your grid there are many cells with the same icon.

B) Initialize an internal collection of icons in the grid window as you did and assign icon indexes to the grid cells.