阅读:766回复:0
请问MapWinGis 如何给shp文件里的某一个shape设置颜色?我这么设置不起效果,请教。
一个省的地图,想实现每个省一个颜色,代码如下,但就是出不来效果,请教......
Shapefile sf = new Shapefile() int handle; sf.Open("C:\\省.shp",null); handle = axMap1.AddLayer(sf,true); axMap1.InvokeEditMode(); if (!sf.StartEditingShapes(true,null)) { return; } string labelText = string.Empty; for(int i=0;i<sf.NumShapes;i++) { labelText = sf.get_CellValue(3,i).ToString(); switch(labelText) { case("河南省"): axMap1.set_ShapeFillColor(handle,i,(uint)ColorTranslator.ToOle(Color.BlueViolet)); break; default: break; } } if (!sf.StopEditingShapes(true,true,null)) { return; } 代码如上,先测试一个省的,断点也跟进去了,执行了axMap1.set_ShapeFillColor但就是出不来效果, 请问是什么原因?我用的MapWinGis 控件版本是4.8 |
|