//get the layer from the mapIFeatureLayer layer = GetFeatureLayer((string)cboLayers.SelectedItem);if (null == layer){txtMessages.Text += "Layer " + (string)cboLayers.SelectedItem + "cannot be found!
";return;}
//scroll the textbox to the bottomScrollToBottom();
txtMessages.Text += "
分析开始,这可能需要几分钟时间,请稍候..
";txtMessages.Update();//get an instance of the geoprocessorGeoprocessor gp = newGeoprocessor();gp.OverwriteOutput = true;
//create a new instance of a buffer toolESRI.ArcGIS.AnalysisTools.Buffer buffer = new ESRI.ArcGIS.AnalysisTools.Buffer(layer, txtOutputPath.Text, Convert.ToString(bufferDistance) + " " + (string)cboUnits.SelectedItem);buffer.dissolve_option = "ALL";//这个要设成ALL,否则相交部分不会融合//buffer.line_side = "FULL";//默认是"FULL",最好不要改否则出错//buffer.line_end_type = "ROUND";//默认是"ROUND",最好不要改否则出错//execute the buffer tool (very easy :-))IGeoProcessorResult results=null;try{results = (IGeoProcessorResult)gp.Execute(buffer, null);}catch (Exception ex){txtMessages.Text += "Failed to buffer layer: " + layer.Name + "
";}if (results.Status != esriJobStatus.esriJobSucceeded){txtMessages.Text += "Failed to buffer layer: " + layer.Name + "
";}//scroll the textbox to the bottomScrollToBottom();
txtMessages.Text += "
分析完成.
";txtMessages.Text += "-----------------------------------------------------------------------------------------
";//scroll the textbox to the bottomScrollToBottom();5 工程代码下载GPBufferLayer源码下载(解压密码:www.gissky.net)