/// <summary> /// Sets the output projection for the transform to the one chosen here. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBoxCoordSys_SelectedIndexChanged(object sender, EventArgs e) { try { ISpatialReference sr = null; ISpatialReferenceFactory3 srFactory = new SpatialReferenceEnvironmentClass(); if (comboBoxCoordSys.SelectedIndex == 4) { if (_map != null && _map.SpatialReference != null) { sr = _map.SpatialReference; labelSR.Text = sr.Name; } else { labelSR.Text = ""; } buttonSR.Enabled = true; _transform.SetGeoTransform(null); } else { if (comboBoxCoordSys.SelectedIndex == 0) { sr = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984); _transform.SetGeoTransform(null); } else { if (comboBoxCoordSys.SelectedIndex == 1) { sr = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1983UTM_10N); } else if (comboBoxCoordSys.SelectedIndex == 2) { sr = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1983UTM_11N); } else if (comboBoxCoordSys.SelectedIndex == 3) { sr = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1983UTM_12N); } IGeoTransformation trans = null; trans = (IGeoTransformation)srFactory.CreateGeoTransformation( (int)esriSRGeoTransformationType.esriSRGeoTransformation_NAD1983_To_WGS1984_1); _transform.SetGeoTransform(trans); } labelSR.Text = ""; buttonSR.Enabled = false; } _transform.SetSpatialReference(sr); if ((_map.SpatialReference == null) || !((IClone)_map.SpatialReference).IsEqual((IClone)sr)) { _map.SpatialReference = sr; ArcMap.Document.ActiveView.Refresh(); } FillDatumTransform(); EnableSelectInputs(); } catch (Exception ex) { ShowError(ex.Message); } }