void axRenderControl1_RcMouseDragSelect(IPickResultCollection PickResults, gviModKeyMask Mask) { IPickResultCollection prc = PickResults; if (prc == null && CTRL && Mask == gviModKeyMask.gviModKeyCtrl) { return; } if (!CTRL || (CTRL && Mask != gviModKeyMask.gviModKeyCtrl)) //ctrl键 { this.axRenderControl1.FeatureManager.UnhighlightAll(); featureList.Clear(); } if (prc != null) { for (int i = 0; i < prc.Count; i++) { IPickResult pr = prc.Get(i); if (pr.Type == gviObjectType.gviObjectFeatureLayer) { IFeatureLayerPickResult flpr = pr as IFeatureLayerPickResult; int fid = flpr.FeatureId; IFeatureLayer fl = flpr.FeatureLayer; foreach (IFeatureClass fc in fcMap.Keys) { if (fc.Guid.Equals(fl.FeatureClassId)) { this.axRenderControl1.FeatureManager.HighlightFeature(fc, fid, System.Drawing.Color.Yellow); FCAndFeature item = new FCAndFeature(); item.fc = fc; item.fid = fid; featureList.Add(item); } } } } } }
void axRenderControl1_RcMouseClickSelect(IPickResult PickResult, IPoint IntersectPoint, gviModKeyMask Mask, gviMouseSelectMode EventSender) { IPickResult pr = PickResult; if (pr == null && CTRL && Mask == gviModKeyMask.gviModKeyCtrl) { return; } if (!CTRL || (CTRL && Mask != gviModKeyMask.gviModKeyCtrl)) //ctrl键 { this.axRenderControl1.FeatureManager.UnhighlightAll(); featureList.Clear(); } if (EventSender == gviMouseSelectMode.gviMouseSelectClick) { if (PickResult != null) { if (pr.Type == gviObjectType.gviObjectFeatureLayer) { IFeatureLayerPickResult flpr = pr as IFeatureLayerPickResult; int fid = flpr.FeatureId; IFeatureLayer fl = flpr.FeatureLayer; foreach (IFeatureClass fc in fcMap.Keys) { if (fc.Guid.Equals(fl.FeatureClassId)) { this.axRenderControl1.FeatureManager.HighlightFeature(fc, fid, System.Drawing.Color.Yellow); FCAndFeature item = new FCAndFeature(); item.fc = fc; item.fid = fid; featureList.Add(item); } } } } } }