代码:

    Variables var = new Variables();
    MapXLib.Layers lyrs = axMapMain.Layers;
    MapXLib.Layer lyr = lyrs._Item(sLayerName);

    Features ftrs = null;

    var.Add ("varCode", lvTerminal.Items[e.Index].Tag.ToString());
    ftrs = lyr.Search("terminal_id=varCode", var);
    TerminalLoopDataSet.terminalRow foundRow = da.GetTerminalRow(" terminal_id = " + lvTerminal.Items[e.Index].Tag);
    if (e.Currentvalue == CheckState.Unchecked )
    {
     foundRow.selected = true;
    }
    else if (e.Currentvalue == CheckState.Checked )
    {
     foundRow.selected = false;
    }
    if (ftrs.Count > 0 )
    {
     System.Console.WriteLine(ftrs.Count.ToString()); 
     if (e.Currentvalue == CheckState.Unchecked )
     {
      System.Console.WriteLine(ftrs._Item(1).FeatureID);
      axMapMain.Layers._Item(sLayerName).Selection.SelectByID(ftrs._Item(1).FeatureID , MapXLib.SelectionTypeConstants.miSelectionAppend);    
      //axMapMain.Layers._Item(sLayerName).Selection.
     }
     else if (e.Currentvalue == CheckState.Checked  )
     {
      System.Console.WriteLine(ftrs._Item(1).FeatureID);
      axMapMain.Layers._Item(sLayerName).Selection.SelectByID(ftrs._Item(1).FeatureID, MapXLib.SelectionTypeConstants.miSelectionRemove ); 
     }
     axMapMain.ZoomTo (axMapMain.Zoom, ftrs._Item(1).CenterX, ftrs._Item(1).CenterY);
    }
   }
   catch(Exception ex)
   {
    Logger.Glog(LogLevel.LogError, ex.ToString());
    //throw ex;
   }
   finally
   {
    this.axMapMain.SelectionChanged += new System.EventHandler(this.axMapMain_SelectionChanged);
   }

  }

相关文章:

  • 2022-12-23
  • 2021-12-02
  • 2021-06-07
  • 2022-12-23
  • 2021-12-05
  • 2021-11-30
  • 2022-12-23
  • 2021-11-11
猜你喜欢
  • 2021-10-14
  • 2021-12-12
  • 2021-11-11
  • 2021-07-01
  • 2021-05-04
  • 2022-12-23
相关资源
相似解决方案