private void MapControl_ShapeLabeling(object sender, _DMapEvents_ShapeHighlightedEvent e) { Shapefile sf = mapControl.get_Shapefile(e.layerHandle); if (sf != null) { sf.SelectionAppearance = tkSelectionAppearance.saDrawingOptions; int idFeature = e.shapeIndex; if (preSelectedShape != -1) { sf.ShapeSelected[preSelectedShape] = false; } sf.ShapeSelected[idFeature] = true; preSelectedShape = idFeature; if (listLabel.SelectedIndices.Count > 0) { for (int i = 0; i < listLabel.SelectedIndices.Count; i++) { listLabel.Items[listLabel.SelectedIndices[i]].Selected = false; } } if (listLabel.Items.Count > 0) { listLabel.Items[idFeature].Selected = true; } } mapControl.Redraw(); }
private _DMapEvents_ShapeHighlightedEvent _e;//点击位置 public InformationForm(AxMap axMap, _DMapEvents_ShapeHighlightedEvent e) { _axMap = axMap; _e = e; flag = true; InitializeComponent(); }
internal ShapeHightlightedEventArgs(_DMapEvents_ShapeHighlightedEvent args) { _args = args; if (args == null) { throw new NullReferenceException("Internal reference is null."); } }
void axMap1_ShapeHighlighted(object sender, _DMapEvents_ShapeHighlightedEvent e) { if (Map.CursorMode == tkCursorMode.cmIdentify && AppSettings.Instance.ShowTooltip) { string s = Map.GetAttributes(e.layerHandle, e.shapeIndex); toolTip1.SetToolTip(Map, s); Application.DoEvents(); } }
private void AxMap1_ShapeHighlighted(object sender, _DMapEvents_ShapeHighlightedEvent e) { if (identifyFlag) { InformationForm informationForm = new InformationForm(axMap1, e); informationForm.Show(); identifyFlag = false; } }
// <summary> // Handles ShapeHighlighted event and shows attributes of the selected shape in the label // </summary> void AxMap1ShapeHighlighted(object sender, _DMapEvents_ShapeHighlightedEvent e) { Shapefile sf = axMap1.get_Shapefile(e.layerHandle); if (sf != null) { string s = ""; for (int i = 0; i < sf.NumFields; i++) { string val = (string)sf.get_CellValue(i, e.shapeIndex); if (val == "") val = "null"; s += sf.Table.Field[i].Name + ":" + val + "; "; } m_label.Text = s; } }
// <summary> // Handles ShapeHighlighted event and shows attributes of the selected shape in the label // </summary> void AxMap1ShapeHighlighted(object sender, _DMapEvents_ShapeHighlightedEvent e) { Shapefile sf = axMap1.get_Shapefile(e.layerHandle); if (sf != null) { string s = ""; for (int i = 0; i < sf.NumFields; i++) { string val = sf.get_CellValue(i, e.shapeIndex).ToString(); if (val == "") { val = "null"; } s += sf.Table.Field[i].Name + ":" + val + "; "; } m_label.Text = s; } }
private void MapControl_ShapeHighlighted(object sender, _DMapEvents_ShapeHighlightedEvent e) { Shapefile sf = mapControl.get_Shapefile(e.layerHandle); if (sf != null) { int idFeature = e.shapeIndex; // Unselected if (listData.SelectedIndices.Count > 0) { for (int i = 0; i < listData.SelectedIndices.Count; i++) { listData.Items[listData.SelectedIndices[i]].Selected = false; } } if (listData.Items.Count > 0) { listData.Items[idFeature].Selected = true; } } }
private void MapShapeHighlighted(object sender, _DMapEvents_ShapeHighlightedEvent e) { Invoke(sender, ShapeHighlighted, new ShapeHightlightedEventArgs(e)); }