Private void button6_click (Object sender, eventargs E)
{
// Create a new algorithmiccolorrampclass object
Ialgorithmiccolorramp algcolorramp = new algorithmiccolorrampclass ();
// Create the starting color object
Irgbcolor startcolor = new rgbcolor ();
Startcolor. red= 255;
Startcolor. Green = 0;
Startcolor. Blue = 0;
// Create an end color object
Irgbcolor endcolor = new rgbcolor ();
Endcolor. Red = 0;
Endcolor. green= 255;
Endcolor. Blue = 0;
// Set the starting and ending color attributes of algorithmiccolorrampclass
Algcolorramp. tocolor = startcolor;
Algcolorramp. fromcolor = endcolor;
// Set the Gradient Type
Algcolorramp. algorithm = esricolorrampalgorithm. esricielabalgorithm;
// Set the color and color Quantity
Algcolorramp. size = 5;
// Create a color band
Bool bture = true;
Algcolorramp. createramp (Out bture );
// Use ienumcolors to obtain the color band
Ienumcolors penumcolors = NULL;
Penumcolors = algcolorramp. colors;
// Set the background color of five pictureboxes to the 5 colors that generate the color band.
This. picturebox1.backcolor = colortranslator. fromole (penumcolors. Next (). RGB );
This. picturebox2.backcolor = colortranslator. fromole (penumcolors. Next (). RGB );
This. picturebox3.backcolor = colortranslator. fromole (penumcolors. Next (). RGB );
This. picturebox4.backcolor = colortranslator. fromole (penumcolors. Next (). RGB );
This. picturebox5.backcolor = colortranslator. fromole (penumcolors. Next (). RGB );
}
From: http://bbs.esrichina-bj.cn/ESRI/thread-46784-1-1.html
Private void button6_click (Object sender, eventargs E)
{
Irandomcolorramp prandomcolorramp = new randomcolorrampclass ();
// ** Create a series of random colors between orange and blue-green
Prandomcolorramp. starthue = 40;
Prandomcolorramp. endhue = 120;
Prandomcolorramp. minvalue = 65;
Prandomcolorramp. maxvalue = 90;
Prandomcolorramp. minsaturation = 25;
Prandomcolorramp. maxsaturation = 45;
Prandomcolorramp. size = 20;
Prandomcolorramp. Seed = 23;
Bool bture = true;
Prandomcolorramp. createramp (Out bture );
Ienumcolors penumcolors = prandomcolorramp. colors;
// Set the background color of five pictureboxes to the 5 colors that generate the color band.
This. picturebox1.backcolor = colortranslator. fromole (penumcolors. Next (). RGB );
This. picturebox2.backcolor = colortranslator. fromole (penumcolors. Next (). RGB );
This. picturebox3.backcolor = colortranslator. fromole (penumcolors. Next (). RGB );
This. picturebox4.backcolor = colortranslator. fromole (penumcolors. Next (). RGB );
This. picturebox5.backcolor = colortranslator. fromole (penumcolors. Next (). RGB );
}