This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Create Simple Line Symbol Snippet (ArcObjects .NET 10.4 SDK) |
Create a simple line symbol by specifying a color, width and line style.
///<summary>Create a simple line symbol by specifying a color, width and line style.</summary> /// ///<param name="rgbColor">An IRGBColor interface.</param> ///<param name="inWidth">A System.Double that is the width of the line symbol in points. Example: 2</param> ///<param name="inStyle">An esriSimpleLineStyle enumeration. Example: esriSLSSolid.</param> /// ///<returns>An ISimpleLineSymbol interface.</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.Display.ISimpleLineSymbol CreateSimpleLineSymbol(ESRI.ArcGIS.Display.IRgbColor rgbColor, System.Double inWidth, ESRI.ArcGIS.Display.esriSimpleLineStyle inStyle) { if(rgbColor == null) { return null; } ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol=new ESRI.ArcGIS.Display.SimpleLineSymbolClass(); simpleLineSymbol.Style=inStyle; simpleLineSymbol.Color=rgbColor; simpleLineSymbol.Width=inWidth; return simpleLineSymbol; }
'''<summary>Create a simple line symbol by specifying a color, width and line style.</summary> ''' '''<param name="rgbColor">An IRGBColor interface.</param> '''<param name="inWidth">A System.Double that is the width of the line symbol in points. Example: 2</param> '''<param name="inStyle">An esriSimpleLineStyle enumeration. Example: esriSLSSolid.</param> ''' '''<returns>An ISimpleLineSymbol interface.</returns> ''' '''<remarks></remarks> Public Function CreateSimpleLineSymbol(ByVal rgbColor As ESRI.ArcGIS.Display.IRgbColor, ByVal inWidth As System.Double, ByVal inStyle As ESRI.ArcGIS.Display.esriSimpleLineStyle) As ESRI.ArcGIS.Display.ISimpleLineSymbol If rgbColor Is Nothing Then Return Nothing End If Dim simpleLineSymbol As ESRI.ArcGIS.Display.ISimpleLineSymbol=New ESRI.ArcGIS.Display.SimpleLineSymbolClass simpleLineSymbol.Style=inStyle simpleLineSymbol.Color=rgbColor simpleLineSymbol.Width=inWidth Return simpleLineSymbol End Function