Community
Showing results for 
Search instead for 
Do you mean 
Reply

Cannot change icon for CommandBarControl object

Tuned Listener
Posts: 29
Country: Canada

Cannot change icon for CommandBarControl object

[ Edited ]
Hi,
 
 I have created a CommandBar object with CommandBarButton objects, and I'm trying to access Icon property for CommandBarButtons, but unfortunately I'm not able to change the Icon for those controls, and I tried changing it in 2 ways:
 
1.

btnSetup = (CommandBarButton)ConverTecToolBar.ControlCollection[7];

btnSetup.Icon = ActCRMIntegrator.Properties.Resources.Rel;

2.

ActApp.Explorer.CommandBarCollection[COMMANDBAR_NAME].ControlCollection[7].Icon = ActCRMIntegrator.Properties.Resources.Rel;

 

 Both of ways did not work and the icon on the button did not change. Am I doing something wrong? or is it a bug? or limitation? I appreciate someone would show me somehow to change an icon on a button please.

Please note that the Icon I'm using is a 19X19 and/or 16X16 colored icon. if there are limitation on the icon size, please let me know.

 

In addition I have tried to change IsVisible property of a CommandBarButton object, and it worked one way! hide the button works (IsVisible=false) but showing it again is not possible (IsVisible=true), unless I hide and show the whole CommandBar object by setting (IsVisible) to false then to true again!! And ofcourse that is not a solution to the problem and there has to be a way to hide and show buttons on the fly without hide and show techinique!

Joe



Message Edited by hickins on 03-26-2008 07:28 AM

Message Edited by hickins on 03-26-2008 08:07 AM

Message Edited by hickins on 03-26-2008 11:21 AM
.NET Developer