ArcObjects Library Reference  (Display)    

IEnumColors Example

[Visual Basic 6.0]
'** Create a new color algorithmic ramp Dim nx As IAlgorithmicColorRamp Set nx = New AlgorithmicColorRamp '** Create the start and end colors Dim tc As IRgbColor, fc As IRgbColor Set tc = New RgbColor Set fc = New RgbColor tc.Red = 255 tc.Green = 200 tc.Blue = 200 fc.Red = 160 fc.Green = 0 fc.Blue = 0 '** Set the Start and End Colors nx.ToColor = tc nx.FromColor = fc '** Set the ramping Alglorithm nx.Algorithm = esriCIELabAlgorithm '** Set the size of the ramp (the number of colors to be derived) nx.Size = 5 '** Create the ramp nx.CreateRamp (True) '** In order to retrieve the colors, use a IEnumColors object Dim hs As IEnumColors Set hs = nx.Colors '** Sets the Background color of five buttons to each of the colors in the ramp. Form2.Command1.BackColor = hs.Next.RGB Form2.Command2.BackColor = hs.Next.RGB Form2.Command3.BackColor = hs.Next.RGB Form2.Command4.BackColor = hs.Next.RGB Form2.Command5.BackColor = hs.Next.RGB

[Visual Basic .NET, C#, C++]
No example is available for Visual Basic .NET, C#, or C++. To view a Visual Basic 6.0 example, click the Language Filter button Language Filter in the upper-left corner of the page.