此代码在 MapXtreme 2004 6.2 版本下通过
以 BarTheme 主题图为例。
Table table = Session.Current.Catalog.OpenTable("Mexico.TAB");
BarTheme bar = new BarTheme(mapControl1.Map, table, "Cars_91", "Trucks_91");
bar.Categories[0].FillStyle = new SimpleInterior(2, Color.Black);
bar.Categories[1].FillStyle = new SimpleInterior(2, Color.Yellow);
Categories 集合的索引对应着主题图字段,上例中 Categories[0] 即对应着 "Cars_91"。
单值主题图的颜色设置略有不同:
FeatureLayer layer = (FeatureLayer)myMap.Layers["world"];
IndividualValueTheme theme = new IndividualValueTheme(layer, "continent", null);
theme.ApplyStylePart = StylePart.Color;
theme.Bins[0].Style.AreaStyle.Interior = new SimpleInterior(2, Color.Gold);
theme.Bins[1].Style.AreaStyle.Interior = new SimpleInterior(2, Color.Blue);
Bins 集合存储了 "continent" 字段的唯一值,通过索引可以为每个值设置不同的样式。