XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Help.basePath);
XmlNode root = xmlDoc.SelectSingleNode("control");
XmlElement timelock = xmlDoc.CreateElement("lock");
XmlElement timelocksub1 = xmlDoc.CreateElement("islock");
timelocksub1.InnerText = checkEditScreenshots.Checked.ToString();
timelock.AppendChild(timelocksub1);
XmlElement timelocksub2 = xmlDoc.CreateElement("locktime");
timelocksub2.InnerText = txtLockTime.Text.Trim();
timelock.AppendChild(timelocksub2);
XmlElement timelocksub3 = xmlDoc.CreateElement("locktimes");
timelocksub3.InnerText = txtLockTimes.Text.Trim();
timelock.AppendChild(timelocksub3);
XmlElement timelocksub4 = xmlDoc.CreateElement("LockRemConType");
timelocksub4.InnerText = Help.LockRemConType.ToString();
timelock.AppendChild(timelocksub4);
XmlElement timelocksub5 = xmlDoc.CreateElement("LockRemCon");
timelocksub5.InnerText = richTxtLockCon.Text.Trim();
timelock.AppendChild(timelocksub5);
root.AppendChild(timelock);
xmlDoc.Save(Help.basePath);
Help.basePath------------------------文件存储路径
control----------------------根节点
“ ”内都是想要创建的节点的名,自己任意定义
最后一定要保存xmlDoc.Save(Help.basePath);