内にメニューボタンがあり、CMFCToolbar
各エントリには独自のアイコンがあるため、メニューで別のエントリが選択されるたびにボタンのビットマップを置き換えたいと思います。
を使用してアイコンを変更することに成功しましたCMFCToolBarMenuButton::SetImage
が、メニューエントリのアイコンも変更されます。残念な。
代替テキスト http://www.freeimagehosting.net/uploads/137269b0f2.jpg 代替テキスト http://www.freeimagehosting.net/uploads/879d03843a.jpg
コードのサンプルを次に示します。
if ( (pToolbar != NULL) && (idBase != 0) )
{
int ixButtonToReplace = pToolbar->CommandToIndex(idBase);
CMFCToolBarMenuButton* pBtnToReplace = dynamic_cast<CMFCToolBarMenuButton*>
(pToolbar->GetButton(ixButtonToReplace));
if ( pBtnToReplace )
{
const CObList& listCommands = pBtnToReplace->GetCommands();
POSITION pos = listCommands.GetHeadPosition();
while ( pos != NULL )
{
CMFCToolBarMenuButton* pItem = (CMFCToolBarMenuButton*) listCommands.GetNext(pos);
if ( pItem && (pItem->m_nID == idButtonToReplaceWith) )
{
pBtnToReplace->SetImage(pItem->GetImage());
}
}
}
}
何か案は?ありがとうございました。