This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Create RGBColor Snippet (ArcObjects .NET 10.4 SDK) |
Generate an RgbColor by specifying the amount of Red, Green and Blue.
///<summary>Generate an RgbColor by specifying the amount of Red, Green and Blue.</summary> /// ///<param name="myRed">A byte (0 to 255) used to represent the Red color. Example: 0</param> ///<param name="myGreen">A byte (0 to 255) used to represent the Green color. Example: 255</param> ///<param name="myBlue">A byte (0 to 255) used to represent the Blue color. Example: 123</param> /// ///<returns>An IRgbColor interface</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.Display.IRgbColor CreateRGBColor(System.Byte myRed, System.Byte myGreen, System.Byte myBlue) { ESRI.ArcGIS.Display.IRgbColor rgbColor=new ESRI.ArcGIS.Display.RgbColorClass(); rgbColor.Red=myRed; rgbColor.Green=myGreen; rgbColor.Blue=myBlue; rgbColor.UseWindowsDithering=true; return rgbColor; }
'''<summary>Generate an RgbColor by specifying the amount of Red, Green and Blue.</summary> ''' '''<param name="myRed">A byte (0 to 255) used to represent the Red color. Example: 0</param> '''<param name="myGreen">A byte (0 to 255) used to represent the Green color. Example: 255</param> '''<param name="myBlue">A byte (0 to 255) used to represent the Blue color. Example: 123</param> ''' '''<returns>An IRgbColor interface</returns> ''' '''<remarks></remarks> Public Function CreateRGBColor(ByVal myRed As System.Byte, ByVal myGreen As System.Byte, ByVal myBlue As System.Byte) As ESRI.ArcGIS.Display.IRgbColor Dim rgbColor As ESRI.ArcGIS.Display.IRgbColor=New ESRI.ArcGIS.Display.RgbColorClass With rgbColor .Red=CInt(myRed) .Green=CInt(myGreen) .Blue=CInt(myBlue) .UseWindowsDithering=True End With Return rgbColor End Function