使用产品:iobject.NET 10i 操作系统:win10 x64
在themeRange.AddToTail(themeRangeItem2);语句总出现外部组件发生异常,但是注释了该语句后就可以正常运行,代码如下:
ThemeRange themeRange = new ThemeRange();
themeRange.RangeExpression = "总磷";
GeoStyle geostyle1 = new GeoStyle
{
LineWidth = 0.5,
LineColor = Color.FromArgb(0, 160, 233)
};
ThemeRangeItem themeRangeItem1 = new ThemeRangeItem
{
Caption = "1",
Start = 0,
End = 0.01,
Style = geostyle1,
IsVisible = true
};
GeoStyle geostyle2 = new GeoStyle
{
LineWidth = 0.5,
LineColor = Color.FromArgb(46, 215, 100)
};
ThemeRangeItem themeRangeItem2 = new ThemeRangeItem
{
Caption = "2",
Start = 0.01,
End = 0.025,
Style = geostyle2,
IsVisible = true
};
GeoStyle geostyle3 = new GeoStyle
{
LineWidth = 0.5,
LineColor = Color.FromArgb(230, 222, 15)
};
ThemeRangeItem themeRangeItem3 = new ThemeRangeItem
{
Caption = "3",
Start = 0.025,
End = 0.05,
Style = geostyle3,
IsVisible = true
};
GeoStyle geostyle4 = new GeoStyle
{
LineWidth = 0.5,
LineColor = Color.Red
};
ThemeRangeItem themeRangeItem4 = new ThemeRangeItem
{
Caption = "4",
Start = 0.05,
End = 1.0,
Style = geostyle4,
IsVisible = true
};
themeRange.AddToHead(themeRangeItem1);
themeRange.AddToTail(themeRangeItem2);
themeRange.AddToTail(themeRangeItem3);
themeRange.AddToTail(themeRangeItem4);
mapControl1.Map.Layers.Add(m_netLine, themeRange, true);
mapControl1.Map.Layers[0].IsSelectable = false;
mapControl1.Map.Layers[0].IsSnapable = false;
mapControl1.Map.Refresh();