ArcGIS Engine
代码共享
-
颜色?/p>
Color
)对象函?/p>
分类?/p>
ArcGIS Engine
2012-01-16 14:36 2287
人阅?/p>
评论
(0)
收藏
举报
classrandomlistmethodsbytenull
1.
public
class
ColorHelper
2.
{
3.
// Fields
4.
private
static
Random m_random =
new
Random();
5.
6.
// Methods
7.
public
static
Color CreateColor(IColor esriColor)
8.
{
9.
Color black = Color.Black;
10.
if
(esriColor !=
null
)
11.
{
12.
if
(esriColor
is
IRgbColor)
13.
{
14.
IRgbColor color2 = esriColor
as
IRgbColor;
15.
black = Color.FromArgb(color2.Red, color2.Green, color2.Blue);
16.
}
17.
else
18.
{
19.
int
red = esriColor.RGB % 0x100;
20.
int
green = (esriColor.RGB / 0x100) % 0x100;
21.
int
blue = ((esriColor.RGB / 0x100) / 0x100) % 0x100;
22.
black = Color.FromArgb(red, green, blue);
23.
}
24.
}
25.
return
black;
26.
}
27.
28.
public
static
IColor CreateColor(Color msColor)
29.
{
30.
return
CreateColor(msColor.R, msColor.G, msColor.B);
31.
}
32.
33.
public
static
IColor CreateColor(
int
red,
int
green,
int
blue)
34.
{
35.
RgbColorClass class2 =
new
RgbColorClass();
36.
class2.Red = red;
37.
class2.Green = green;
38.
class2.Blue = blue;
39.
return
class2;