- 积分
- 5295
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-28
- 最后登录
- 1970-1-1
|
发表于 2012-4-11 21:33:23
|
显示全部楼层
本帖最后由 sysun 于 2012-4-11 21:36 编辑
我也来交份作业。
还有问题请教:1、我现在用的是最新版的MeteoInfoC,不知为什么,王老师给出的例子,在我的系统中有些语句不能通过,如前面的例子,不知是不是版本的原因。2、breakList[0]中的"0"代表什么?
- private void LoadLayers()
- {
- layersLegend1.ActiveMapFrame.MapView.LockViewUpdate = true;
- //Load country layer
- string aFile = Application.StartupPath + "\\Map\\country1.shp";
- MapLayer aLayer = MapDataManage.OpenLayer(aFile);
- aLayer.LegendScheme.breakList[0].Color = Color.WhiteSmoke;
- layersLegend1.ActiveMapFrame.AddLayer(aLayer);
- //Load river layer
- aFile = Application.StartupPath + "\\Map\\rivers.shp";
- aLayer = MapDataManage.OpenLayer(aFile);
- aLayer.LegendScheme.breakList[0].Color = Color.Aqua; // <-----------运行到这里往下就过不去了
- ((PolyLineBreak)aLayer.LegendScheme.breakList[0]).Size = 2;
- layersLegend1.ActiveMapFrame.AddLayer(aLayer);
- //Load city layer
- aFile = Application.StartupPath + "\\Map\\CITIES.shp";
- aLayer = MapDataManage.OpenLayer(aFile);
- ((PointBreak)aLayer.LegendScheme.breakList[0]).Color = Color.Red;
- aLayer.Expanded = true;
- layersLegend1.ActiveMapFrame.AddLayer(aLayer);
- //Label city name
- VectorLayer cityLayer = (VectorLayer)aLayer;
- cityLayer.LabelSet.FieldName = "NAME";
- cityLayer.LabelSet.AvoidCollision = true;
- cityLayer.LabelSet.LabelAlignType = MeteoInfoC.Legend.AlignType.Center;
- cityLayer.LabelSet.Offset = 0;
- cityLayer.LabelSet.LabelFont = new Font("Arial", 8);
- cityLayer.LabelSet.LabelColor = Color.Red;
- cityLayer.LabelSet.DrawShadow = false;
- cityLayer.LabelSet.ShadowColor = Color.White;
- cityLayer.LabelSet.ColorByLegend = false;
- cityLayer.AddLabels();
- //Set layout map size
- mapLayout1.ActiveLayoutMap.Left = 40;
- mapLayout1.ActiveLayoutMap.Top = 40;
- mapLayout1.ActiveLayoutMap.Width = 600;
- mapLayout1.ActiveLayoutMap.Height = 400;
- //Refresh
- layersLegend1.ActiveMapFrame.MapView.LockViewUpdate = false;
- layersLegend1.ActiveMapFrame.MapView.ZoomToExtent(70, 140, 10, 60);
- layersLegend1.Refresh();
- }
复制代码 |
|