ArcEngine颜色可视化

时间:2022-09-28 02:28:46

AE中利用.NET中的ColorDialog对话框,将color对象转化为ArcEngine中的IRgbColor

(1)在实现颜色选择之前,需定义这两种颜色之间的转换函数

//Color转换为Rgbcolor

 private IRgbColor GetIRgbcolor()
{
ColorDialog pColorDialog = new ColorDialog();
if (pColorDialog.ShowDialog() == DialogResult.OK)
{
return ConvertColorToIRgbcolor(pColorDialog.Color);
}
else
{
return null;
} }
private Color ConvertIRgbColorToColor(IRgbColor pRgbcolor)
{ return ColorTranslator.FromOle(pRgbcolor.RGB);
}
private IRgbColor ConvertColorToIRgbcolor(Color pColor)
{
IRgbColor pRgbcolor=new RgbColorClass();
pRgbcolor.RGB=pColor.R+pColor.G*+pColor.B*; return pRgbcolor;
}