首页 / 浏览问题 / 组件GIS / 问题详情
iObjects .net 11i 中无法设置高亮
16EXP 2025年07月30日

问题描述:左键点击后高亮,如果这个面区域已经高亮了则取消高亮,如果没有高亮则显示高亮;在GeometrySelected中进行高亮设置,目前用selection设置风格但高亮无法显示

private void mapControl_GeometrySelected(object sender, GeometrySelectedEventArgs e)
 {
     try
     {
         Selection selections = m_mapControl.Map.FindSelection(true)[0];
         if (selections == null && selections.Count == 0) return;

         // 获取当前线图层的选择记录集
         Recordset recordset = selections.ToRecordset();
         if (recordset == null || recordset.RecordCount == 0) return;
         GeoStyle geostyle = new GeoStyle();
         geostyle.FillForeColor = System.Drawing.Color.Blue;
         string name = recordset.GetFieldValue("NAME").ToString().Trim();
         // 遍历选中的要素并设置样式
         selections.SetStyleOptions(StyleOptions.FillForeColor, true);
         selections.Style = geostyle;
         m_layer.Selection = selections;
         m_mapControl.Map.Refresh();

     }
     catch (Exception ex)
     {
         new Exception("图层高亮失败:"+ex);
         return;
     }
 }

...