class CGXBitmapButton: public CGXControl
The CGXBitmapButton class implements a bitmap button that can be used in grid cells.
To display bitmaps in cells, you need to register a CGXBitmapButton object for each different bitmap button. When the object is created you should pass the resource ids of the bitmap to the CGXBitmapButton constructor. CGXBitmapButton can be used as a pushbutton. You can specify bitmaps for normal state, pressed state and focus-state.
When the user clicks the bitmap, the control's OnClickedButton method is called. The default behavior of OnClickedButton is to call CGXGridCore::OnClickedButtonRowCol.
To process this event, you can either subclass CGXBitmapButton and override the control’s OnClickedButton method, or simply override OnClickedButtonRowCol in your CGXGridCore-derived class.
The following steps are necessary to display bitmaps in cells:
1. You need to add a string resource:
Example:
// Your .RC - file:
STRINGTABLE DISCARDABLE
BEGIN
IDS_CTRL_BITMAP "Welcome bitmap"
END
2. In OnInitialUpdate, you should pass a new instance of the object together with the string resource id to RegisterControl.
void CGridSampleView::OnInitialUpdate( )
{
...
RegisterControl(IDS_CTRL_BITMAP,
new CGXBitmapButton(this, IDB_WELCOME));
}
3. Now, you can apply the bitmap to any cell in the grid with CGXStyle::SetControl.
// Display the welcome bitmap
SetStyleRange(CGXRange( 3, 2 ), CGXStyle( )
.SetControl( IDS_CTRL_BITMAP ));
#include <gxall.h>
See Also
CGXGridCore::RegisterControl CGXStyle::SetControl CGXControl::OnClickedButton CGXGridCore::OnClickedButtonRowCol