Public Sub SetAsIconAndText() ' Make sure button is showing Icon And Text Dim pUID As New UID pUID.Value = "{F53B91E1-C520-41a7-941C-686AA071D1A2}" ' Toolbar GUID Dim pCommandBar As ESRI.ArcGIS.Framework.ICommandBar pCommandBar = m_application.Document.CommandBars.Find(pUID, True, False) Dim i As Integer If Not pCommandBar Is Nothing Then For i = 0 To pCommandBar.Count - 1 If pCommandBar.Item(i).Name = "FocusCorp_FocusEllipse" Then ' use the Property NAME of the button pCommandBar.Item(i).Style = esriCommandStyles.esriCommandStyleIconAndText Exit For End If Next End If End Sub
UIDClass p_UID = new UIDClass(); p_UID.Value = ThisAddIn.IDs.<ButtonID>; ICommandItem p_CommandItemLogin = ((IDocument)ArcMap.Document).CommandBars.Find(p_UID, false, true) as ICommandItem; p_CommandItemLogin.Style = ESRI.ArcGIS.SystemUI.esriCommandStyles.esriCommandStyleIconAndText; p_CommandItemLogin.Refresh();
base.m_bitmap = new Bitmap(GetType(), bitmapResourceName);
I found this:
http://gis.stackexchange.com/questions/1297/can-you-programmatically-change-the-button-image-for-a-e...
and it works for me! 😄
private void SetButtonStyle() { ICommandBars commandBars = ArcMap.Application.Document.CommandBars; ICommandItem commandItem = commandBars.Find(ThisAddIn.IDs.YourButtonClassNameHere, true, false); if (commandItem != null) { commandItem.Style = esriCommandStyles.esriCommandStyleIconAndText; } }
Public Sub SetAsIconAndText() ' Make sure button is showing Icon And Text ' Dim pUID As New UID 'not needed ' pUID.Value = My.ThisAddIn.AddInID ' ' Toolbar GUID ' not needed Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem pCommandItem = My.ArcMap.Application.Document.CommandBars.Find(My.ThisAddIn.IDs.PrecisionXYButton, true, false) pCommandItem.Style = ESRI.ArcGIS.SystemUI.esriCommandStyles.esriCommandStyleIconAndText End Sub
Public Sub SetAsIconAndText() ' Make sure button is showing Icon And Text Dim pUID As New UID pUID.Value = "{6298A204-AD3A-9573-D5E7-E8952250BA36}" ' Toolbar GUID" Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem pCommandItem = My.ArcMap.Application.Document.CommandBars.Find(pUID, True, False) pCommandItem.Style = ESRI.ArcGIS.SystemUI.esriCommandStyles.esriCommandStyleTextOnly End Sub
The code below works, but never found a way to have it work on loading the toolbar.
OnClick - well, thats too late
OnUpdate ?
Sub Finalize?
AddIns are not loaded at Application StartUp , Delay loading...