public class TogglingCommand : BaseCommand { public TogglingCommand() { m_bitmap = Resources.GenerateCalloutsTrue; } private bool IsEnabled { get; set; } public override void OnClick() { IsEnabled = !IsEnabled; UpdateBitmap( IsEnabled ? Resources.GenerateCalloutsTrue : Resources.GenerateCalloutsFalse ); base.OnClick(); } public override void OnCreate( object hook ) { } }
public override void OnClick() { IsEnabled = !IsEnabled; ICommandBars commandBars = m_application.Document.CommandBars; ESRI.ArcGIS.esriSystem.UID commandBarID = new ESRI.ArcGIS.esriSystem.UIDClass(); commandBarID.Value = "sampleComponent.TogglingCommand"; ICommandItem commandToolBarItem = commandBars.Find(commandBarID, false, false); if (IsEnabled == true) { commandToolBarItem.FaceID = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(Resources.GenerateCalloutsTrue); } else { commandToolBarItem.FaceID = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(Resources.GenerateCalloutsFalse); } commandToolBarItem.Refresh(); }
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.