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 General Discussion » Dinamic icon loading Collapse All
Subject Author Date
Max Ryazanov Feb 18, 2004 - 2:33 PM

How can I dinamicaly set icon bitmaps in CExtToolControlBar?

Sergiy Lavrynenko Feb 20, 2004 - 3:43 AM

Hi Max,


The Prof-UIS toolbar stores only command identifiers of its buttons. When it needs an icon, the toolbar uses it from the command manager. Please use the command manager’s CmdSetIcon() method:


 UINT nCmdID = ID_MY_COMMAND;
 HICON hIcon = . . .
 bool bCopyIcon = true;
 // if bCopyIcon is set to false - use hIcon as is
 // if bCopyIcon is set to true - store cloned hIcon
 VERIFY(
  g_CmdManager->CmdSetIcon(
   g_CmdManager->ProfileNameFromWnd(
    pMyToolbar->GetSafeHwnd()
    ),
   nCmdID,
   hIcon,
   bCopyIcon
   )
  );

If a new icon is of the same size as the previous, invalidate your toolbar:


 if( pMyToolbar->IsVisible() )
  pMyToolbar->Invalidate();

Otherwise, you need to recalculate the layout of toolbar’s parent frame:


 if( pMyToolbar->IsVisible() )
  pMyToolbar->GetParentFrame()->RecalcLayout();

Best regards, Sergiy.

Max Ryazanov Feb 21, 2004 - 4:42 AM

It`s working! :) A lot of thanks!!!!

Max Ryazanov Feb 21, 2004 - 7:51 AM

But...Why if icon has 32x32 or 16x16 size, it is dislplying with transparency, interpreting RGB(192,192,192) as transparent color, in other cases - RGB(192,192,192) color drawing.