Toolbar button bitmap not loaded

  • Thread starter Thread starter VickyCool4U
  • Start date Start date
V

VickyCool4U

Guest
Hi Experts,


I have created (own class derive from CToolBar)MFC based application using CToolBar(with 4 buttons) in Visual Studio 2010.

I am trying to create the toolbar at run time using the following code:-

here is my code:-


static UINT BASED_CODE ToolsA[] =
{
ID_ONE,
ID_TWO,
ID_THREE,
ID_FOUR




};


if(!this.CreateEx(this, TBSTYLE_FLAT, WS_CHILD |
WS_VISIBLE | CBRS_TOOLTIPS | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!this.LoadBitmap(IDB_BITMAP2) ||!this.SetButtons(ToolsA,sizeof(ToolsA)/sizeof(UINT)))
{
EndDialog(IDCANCEL);
}


Here I loaded runtime the icon for individual button using LoadIcon(),Replace() and SetImageList().
All the buttons are displaying with correct icon/image

But I would like to disable certain button such as first and third button.
So I use the following code:-

GetToolBarCtrl().EnableButton(ID_ONE,false)

GetToolBarCtrl().EnableButton(ID_THREE,false)
But it is not showing the icon loaded on those button as well. I want the icon to be loaded on those button, but particular button remain in disabled state for particular operation and can be enabled on some other condition.

Is there exist a way where I can make sure the button is in disabled state where its image/icon is displayed too.

Continue reading...
 
Back
Top