//创建XML
XmlDocument StandardXml = new XmlDocument();
void sc_MouseDoubleClick(object sender, MouseEventArgs e)
{
Dot3D dot1 = this.scenControl.WpToLp(e.X, e.Y);
//添加第一行编码等格式。
XmlDeclaration _Describe = StandardXml.CreateXmlDeclaration("1.0", "gb2312", "yes");
StandardXml.AppendChild(_Describe);
//创建第一个大节点
XmlElement xml = StandardXml.CreateElement("XML");
XmlElement firstXML = StandardXml.CreateElement("firstXML");
XmlElement Xzhou = StandardXml.CreateElement("Xzhou");
Xzhou.InnerText = dot1.X.ToString();
firstXML.AppendChild(Xzhou);
XmlElement Yzhou = StandardXml.CreateElement("Yzhou");
Yzhou.InnerText = dot1.Y.ToString();
firstXML.AppendChild(Yzhou);
XmlElement Zzhou = StandardXml.CreateElement("Zzhou");
Zzhou.InnerText = dot1.Z.ToString();
firstXML.AppendChild(Zzhou);
xml.AppendChild(firstXML);
StandardXml.AppendChild(xml);
StandardXml.Save("E://paishuikou.xml");
if (File.Exists("E://paishuikou.xml"))
{
MessageBox.Show("保存成功!");
}
}