private void exportTextRenderToolStripMenuItem_Click(object sender, EventArgs e) { string nodeName = selectNode.Text; myListNode node = selectNode as myListNode; IFeatureLayer layer = node.layer; string renderStr = layer.GetTextRender().AsXml(); SaveFileDialog sd = new SaveFileDialog(); sd.AddExtension = true; sd.DefaultExt = "xml"; sd.Filter = "XML文件|*.xml"; sd.RestoreDirectory = true; if (sd.ShowDialog() == DialogResult.OK) { String final = sd.FileName; if (sd.FileName.LastIndexOf(".xml") == -1) { final = String.Format("{0}.xml", sd.FileName); } System.IO.File.WriteAllText(final, renderStr); MessageBox.Show("导出成功"); } }