/// <summary> /// 地图就绪事件 /// </summary> /// <param name="e"></param> void iMSMap1_MapReady(ZDIMS.Event.IMSMapEvent e) { if (!DesignerProperties.IsInDesignTool) { //添加图片填充区域对象 IMSPictureFillStyle PicFill = new IMSPictureFillStyle(); //添加对象选择监听事件 PicFill.ChossedMarkerOverCallBack += new IMSPictureFillStyle.ChossedMarkerHander(callback); this.graphicsLayer.AddGraphics(PicFill);//添加对象 //设置坐标 PicFill.Points.Add(new Point(8.99919517012924, 29.671057152220655)); PicFill.Points.Add(new Point(12.99919517012924, 10.671057152220655)); PicFill.Points.Add(new Point(-40.99919517012924, 12.671057152220655)); PicFill.Draw();//绘制对象 //添加预定义多边形对象 IMSSimpleFillStyle fill = new IMSSimpleFillStyle(); this.graphicsLayer.AddGraphics(fill); fill.ChossedMarkerOverCallBack += callback;//监听选择事件 //设置坐标 fill.Points.Add(new Point(10.99919517012924, 29.671057152220655)); fill.Points.Add(new Point(19.99919517012924, 10.671057152220655)); fill.Points.Add(new Point(33.99919517012924, 32.671057152220655)); fill.Draw(); } }
/// <summary> /// 添加多边形事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddPolygon_Click(object sender, RoutedEventArgs e) { //初始化多边形对象 IMSSimpleFillStyle fill = new IMSSimpleFillStyle(); fill.IsShowMenum = true; //容许显示多边形右键菜单 fill.IsCursor = true; //鼠标状态为手形 fill.ChossedMarkerOverCallBack += callback; //监听图形选择事件 this.graphicesLaye.AddGraphics(fill); //图形添加到绘图层中 fill.Points.Add(new Point(10.99919517012924, 29.671057152220655)); //设置多边形的坐标 fill.Points.Add(new Point(19.99919517012924, 10.671057152220655)); fill.Points.Add(new Point(12.99919517012924, 30.671057152220655)); fill.Draw();//绘制多边形 }