This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Set MOLE Layer Size Snippet (ArcObjects .NET 10.4 SDK) |
Sets/Changes the size of graphics in a MOLE layer (Force Element or Tactical Graphic)
///<summary>Sets/Changes the size of graphics in a MOLE layer (Force Element or Tactical Graphic)</summary> /// ///<param name="cachedGraphicLayer">An ICachedGraphicLayer interface that is a MOLE layer.</param> ///<param name="symbolSize">A System.Double that is the size of graphics (in map units). Example: 0.5</param> ///<param name="textSize">A System.Double that is size of labels of graphics in the layer (in map units) only used if a Tactical Graphic layer is provided. Example: 0.5</param> /// ///<returns>A System.Boolean where true if successful, false otherwise.</returns> /// ///<remarks></remarks> public System.Boolean SetMoleLayerSize(ESRI.ArcGIS.DefenseSolutions.ICachedGraphicLayer cachedGraphicLayer, System.Double symbolSize, System.Double textSize) { // Important: // The consumer of this procedure must still call // MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, cachedGraphicLayer, null); // (or the equivalent) in order for the size change to appear on the map. System.Boolean success=false; if (cachedGraphicLayer == null) return false; ESRI.ArcGIS.DefenseSolutions.IForceElementLayer forceElementLayer=cachedGraphicLayer as ESRI.ArcGIS.DefenseSolutions.IForceElementLayer; if (forceElementLayer != null) { forceElementLayer.Size=symbolSize; forceElementLayer.SizeIsRatio=false; success=true; } else { ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicLayer tacticalGraphicLayer=cachedGraphicLayer as ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicLayer; if (tacticalGraphicLayer == null) return false; // failed tacticalGraphicLayer.TextSize=textSize; ESRI.ArcGIS.DefenseSolutions.ICachedGraphicLayer2 cachedGraphicLayer2=tacticalGraphicLayer as ESRI.ArcGIS.DefenseSolutions.ICachedGraphicLayer2; cachedGraphicLayer2.Size=symbolSize; success=true; } cachedGraphicLayer.Refresh(); return success; }
'''<summary>Sets/Changes the size of graphics in a MOLE layer (Force Element or Tactical Graphic)</summary> ''' '''<param name="cachedGraphicLayer">An ICachedGraphicLayer interface that is a MOLE layer.</param> '''<param name="symbolSize">A System.Double that is the size of graphics (in map units). Example: 0.5</param> '''<param name="textSize">A System.Double that is size of labels of graphics in the layer (in map units) only used if a Tactical Graphic layer is provided. Example: 0.5</param> ''' '''<returns>A System.Boolean where true if successful, false otherwise.</returns> ''' '''<remarks></remarks> Public Function SetMoleLayerSize(ByVal cachedGraphicLayer As ESRI.ArcGIS.DefenseSolutions.ICachedGraphicLayer, ByVal symbolSize As System.Double, ByVal textSize As System.Double) As System.Boolean ' Important: ' The consumer of this procedure must still call ' MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, cachedGraphicLayer, Nothing); ' (or the equivalent) in order for the size change to appear on the map. Dim success As System.Boolean=False If cachedGraphicLayer Is Nothing Then Return False End If If TypeOf cachedGraphicLayer Is ESRI.ArcGIS.DefenseSolutions.IForceElementLayer Then Dim forceElementLayer As ESRI.ArcGIS.DefenseSolutions.IForceElementLayer=CType(cachedGraphicLayer, ESRI.ArcGIS.DefenseSolutions.IForceElementLayer) ' Explicit Cast forceElementLayer.Size=symbolSize forceElementLayer.SizeIsRatio=False success=True Else Dim tacticalGraphicLayer As ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicLayer=CType(cachedGraphicLayer, ESRI.ArcGIS.DefenseSolutions.ITacticalGraphicLayer) ' Explicit Cast tacticalGraphicLayer.TextSize=textSize Dim cachedGraphicLayer2 As ESRI.ArcGIS.DefenseSolutions.ICachedGraphicLayer2=CType(tacticalGraphicLayer, ESRI.ArcGIS.DefenseSolutions.ICachedGraphicLayer2) ' Explicit Cast cachedGraphicLayer2.Size=symbolSize success=True End If cachedGraphicLayer.Refresh() Return success End Function