網(wǎng)站首頁(yè) 編程語(yǔ)言 正文
實(shí)踐過(guò)程
效果
代碼
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
static public string strName = "";//記錄讀取時(shí)XML文件路徑
static public string strOne = "";//定義兩個(gè)變量保存文本框內(nèi)的值
static public string strTwo = "";
static public string strThree = "";//保存子標(biāo)記名稱
static public string strFour = "";//保存第二個(gè)子節(jié)點(diǎn)的屬性名
static public string strFive = "";//保存第二個(gè)節(jié)點(diǎn)的屬性值
static public string strSix = "";//保存節(jié)點(diǎn)路徑
private XmlDocument xmlDocument = new XmlDocument();
private XmlNode xmlNode;
private XmlElement xmlElement;
DataSet dataSet = new DataSet();//聲明此數(shù)據(jù)集,存儲(chǔ)讀取出的XML數(shù)據(jù)
private void Form1_Load(object sender, EventArgs e)
{
strName = "fileTwo.xml";
if (File.Exists(strName))
{
ShowXml();
button3.Enabled = false;
}
else
{
button3.Enabled = true;
}
}
//修改創(chuàng)建的XML文件
private void button7_Click(object sender, EventArgs e)
{
//修改第一個(gè)節(jié)點(diǎn)的屬性
xmlDocument.Load(strName);
XmlNode nodeOne = xmlDocument.SelectSingleNode("http://" + strThree);
XmlElement ElementOne = (XmlElement)nodeOne;
ElementOne.SetAttribute(attribute.Text, textBox4.Text);
//修改第一個(gè)節(jié)點(diǎn)的值
XmlNode nodeTwo = xmlDocument.SelectSingleNode("http://" + strThree + "/*");
XmlElement ElementTwo = (XmlElement)nodeTwo;
ElementTwo.InnerText = nodeContent.Text;
//修改第二個(gè)節(jié)點(diǎn)的屬性值
XmlNode mainNodeThree = xmlDocument.SelectSingleNode("http://" + textBox7.Text + "[@" + strFour + "='" + strFive + "']");
XmlElement ElementThree = (XmlElement)mainNodeThree;
ElementThree.SetAttribute(textBox10.Text, textBox8.Text);
//修改第二個(gè)節(jié)點(diǎn)的值
XmlNode nodeFour = xmlDocument.SelectSingleNode("http://" + textBox7.Text + "[@" + strFour + "='" + textBox8.Text + "']/*");
XmlElement ElementFour = (XmlElement)nodeFour;
ElementFour.InnerText = textBox11.Text;
xmlDocument.Save(strName);
MessageBox.Show("恭喜你,修改成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
ShowXml();
}
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
//修改文本框的ReadOnly屬性
readOnlytrue();
//選定DataGridView中的一條記錄在文本框內(nèi)顯示
for (int i = 0; i < dataGridView1.Rows.Count; i++) //遍歷DataGridView中的每一行信息
{
if (dataGridView1.Rows[i].Selected)//判斷該行是否被選中
{
if (i <= 0)
{
nodeContent.Text = dataGridView1.Rows[i].Cells[childNode.Text].Value.ToString(); //在文本框內(nèi)顯示XML文件內(nèi)的信息
textBox4.Text = dataGridView1.Rows[i].Cells[attribute.Text].Value.ToString();
strOne = nodeContent.Text;
}
if (i > 0)
{
textBox11.Text = dataGridView1.Rows[i].Cells[childNode.Text].Value.ToString();
textBox8.Text = dataGridView1.Rows[i].Cells[attribute.Text].Value.ToString();
strTwo = textBox11.Text;
strFive = textBox8.Text;
}
}
}
//從指定路徑加載XML文檔
xmlDocument.Load(strName);
//從根節(jié)點(diǎn)開始讀取
XmlNode xNode = (XmlNode)xmlDocument.DocumentElement;
root.Text = xNode.Name;
//讀取子節(jié)點(diǎn)的屬性及內(nèi)容
XmlNode nodeTwo = xmlDocument.SelectSingleNode(root.Text + "/*");
firstNode.Text = nodeTwo.Name;
textBox7.Text = firstNode.Text;
strThree = firstNode.Text;
//讀取次子節(jié)點(diǎn)的名稱及內(nèi)容
XmlNode nodeThree = xmlDocument.SelectSingleNode(root.Text + "/" + firstNode.Text + "/*");
childNode.Text = nodeThree.Name;
textBox9.Text = childNode.Text;
//讀取指定節(jié)點(diǎn)的屬性名
XmlNode nodeOne = xmlDocument.SelectSingleNode("http://" + firstNode.Text);
XmlAttributeCollection xmlAttribute = nodeOne.Attributes;
for (int i = 0; i < xmlAttribute.Count; i++)
{
if (i == 0)
{
attribute.Text = xmlAttribute.Item(i).Name;
textBox10.Text = attribute.Text;
strFour = textBox10.Text;
}
}
}
//自定義一個(gè)方法更改文本框的只讀屬性
private void readOnlytrue()
{
root.ReadOnly = true;
childNode.ReadOnly = true;
attribute.ReadOnly = true;
firstNode.ReadOnly = true;
textBox7.ReadOnly = true;
textBox9.ReadOnly = true;
textBox10.ReadOnly = true;
}
//選定DataGridView中的數(shù)據(jù),進(jìn)行刪除操作
private void button2_Click(object sender, EventArgs e)
{
//判斷是否有選中行
if (dataGridView1.SelectedRows.Count != 0)
{
xmlDocument.Load(strName);
//通過(guò)循環(huán)獲取選中行的XPath
for (int i = 0; i < dataGridView1.Rows.Count; i++) //遍歷DataGridView中的每一行信息
{
if (dataGridView1.Rows[i].Selected)//判斷該行是否被選中
{
string attriString = dataGridView1.Rows[i].Cells[attribute.Text].Value.ToString();
strSix = root.Text + "/" + strThree + "[@" + strFour + "='" + attriString + "']";//被選中節(jié)點(diǎn)的XPath
}
}
string mainNode = strSix.Substring(0, strSix.LastIndexOf("/"));
xmlDocument.SelectSingleNode(mainNode).RemoveChild(xmlDocument.SelectSingleNode(strSix));//從XML文件下移除節(jié)點(diǎn)的語(yǔ)句
xmlDocument.Save(strName);
ShowXml();
}
else
{
MessageBox.Show("暫無(wú)選中行,不能進(jìn)行刪除操作!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
//添加記錄到當(dāng)前節(jié)點(diǎn)下
private void button1_Click(object sender, EventArgs e)
{
if (textBox6.Text != "")
{
xmlDocument.Load(strName);
//添加節(jié)點(diǎn)的屬性及屬性值
XmlNode nodeOne = xmlDocument.SelectSingleNode(root.Text);
XmlElement elementOne = xmlDocument.CreateElement(textBox6.Text);
elementOne.SetAttribute(textBox3.Text, textBox1.Text);
nodeOne.AppendChild(elementOne);
//添加當(dāng)前節(jié)點(diǎn)的子節(jié)點(diǎn)及節(jié)點(diǎn)內(nèi)容
XmlNode nodeTwo = xmlDocument.SelectSingleNode("http://" + textBox6.Text + "[@" + strFour + "='" + textBox1.Text + "']");
XmlElement elementTwo = xmlDocument.CreateElement(textBox2.Text);
elementTwo.InnerText = textBox5.Text;
nodeTwo.AppendChild(elementTwo);
xmlDocument.Save(strName);
MessageBox.Show("節(jié)點(diǎn)添加成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
ShowXml();
}
else
{
MessageBox.Show("節(jié)點(diǎn)內(nèi)容不能為空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
//讀取XML文件
public void ShowXml()
{
//讀取XML文件信息
dataSet.Clear();
dataSet.ReadXml(strName);
dataGridView1.DataSource = dataSet.Tables[0].DefaultView;
}
//創(chuàng)建一個(gè)XML文檔
private void button3_Click(object sender, EventArgs e)
{
//添加X(jué)ML的聲明部分
xmlNode = xmlDocument.CreateNode(XmlNodeType.XmlDeclaration, "", "");
xmlDocument.AppendChild(xmlNode);
//添加一個(gè)根節(jié)點(diǎn)
xmlElement = xmlDocument.CreateElement("", root.Text, "");
xmlDocument.AppendChild(xmlElement);
//添加一個(gè)帶屬性值的次根節(jié)點(diǎn)
XmlNode mainNode = xmlDocument.SelectSingleNode(root.Text);
XmlElement ElementTwo = xmlDocument.CreateElement(firstNode.Text);
ElementTwo.SetAttribute(attribute.Text, textBox4.Text);
mainNode.AppendChild(ElementTwo);
//在當(dāng)前節(jié)點(diǎn)添加一個(gè)僅帶值的節(jié)點(diǎn)
XmlNode mainNodeOne = xmlDocument.SelectSingleNode(@root.Text + "/" + firstNode.Text);
XmlElement ElementThree = xmlDocument.CreateElement(childNode.Text);
ElementThree.InnerText = nodeContent.Text;
mainNodeOne.AppendChild(ElementThree);
//在根節(jié)點(diǎn)下,添加第二個(gè)子節(jié)點(diǎn)
XmlNode mainNodeTwo = xmlDocument.SelectSingleNode(root.Text);
XmlElement ElementFour = xmlDocument.CreateElement(textBox7.Text);
ElementFour.SetAttribute(textBox10.Text, textBox8.Text);
mainNodeTwo.AppendChild(ElementFour);
strFour = textBox10.Text;
//在當(dāng)前節(jié)點(diǎn)添加一個(gè)僅帶值的節(jié)點(diǎn)
XmlNode mainNodeThree = xmlDocument.SelectSingleNode("http://" + textBox7.Text + "[@" + strFour + "='" + textBox8.Text + "']");
XmlElement ElementFive = xmlDocument.CreateElement(textBox9.Text);
ElementFive.InnerText = textBox11.Text;
mainNodeThree.AppendChild(ElementFive);
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.Filter = "XML文件(*.XML)|*.XML";
if (saveDialog.ShowDialog() == DialogResult.OK)
{
xmlDocument.Save(saveDialog.FileName);
}
}
}
partial class Form1
{
/// <summary>
/// 必需的設(shè)計(jì)器變量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
/// <param name="disposing">如果應(yīng)釋放托管資源,為 true;否則為 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗體設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要
/// 使用代碼編輯器修改此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.label18 = new System.Windows.Forms.Label();
this.root = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.firstNode = new System.Windows.Forms.TextBox();
this.childNode = new System.Windows.Forms.TextBox();
this.attribute = new System.Windows.Forms.TextBox();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.label20 = new System.Windows.Forms.Label();
this.nodeContent = new System.Windows.Forms.TextBox();
this.label17 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.textBox7 = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button();
this.label23 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.textBox11 = new System.Windows.Forms.TextBox();
this.textBox10 = new System.Windows.Forms.TextBox();
this.textBox9 = new System.Windows.Forms.TextBox();
this.textBox8 = new System.Windows.Forms.TextBox();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.groupBox6.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout();
this.SuspendLayout();
//
// groupBox5
//
this.groupBox5.Controls.Add(this.dataGridView1);
this.groupBox5.Location = new System.Drawing.Point(12, 134);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(748, 161);
this.groupBox5.TabIndex = 1313;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "顯示XML文件內(nèi)容";
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ActiveCaption;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(2, 12);
this.dataGridView1.MultiSelect = false;
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(745, 151);
this.dataGridView1.TabIndex = 1306;
this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged);
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(9, 17);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(65, 12);
this.label18.TabIndex = 1308;
this.label18.Text = "初始節(jié)點(diǎn):";
//
// root
//
this.root.Location = new System.Drawing.Point(80, 14);
this.root.Name = "root";
this.root.Size = new System.Drawing.Size(100, 21);
this.root.TabIndex = 0;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(266, 42);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(100, 21);
this.textBox4.TabIndex = 3;
//
// firstNode
//
this.firstNode.Location = new System.Drawing.Point(265, 12);
this.firstNode.Name = "firstNode";
this.firstNode.Size = new System.Drawing.Size(100, 21);
this.firstNode.TabIndex = 1;
//
// childNode
//
this.childNode.Location = new System.Drawing.Point(80, 70);
this.childNode.Name = "childNode";
this.childNode.Size = new System.Drawing.Size(100, 21);
this.childNode.TabIndex = 4;
//
// attribute
//
this.attribute.Location = new System.Drawing.Point(80, 42);
this.attribute.Name = "attribute";
this.attribute.Size = new System.Drawing.Size(100, 21);
this.attribute.TabIndex = 2;
//
// groupBox6
//
this.groupBox6.Controls.Add(this.label18);
this.groupBox6.Controls.Add(this.root);
this.groupBox6.Controls.Add(this.textBox4);
this.groupBox6.Controls.Add(this.firstNode);
this.groupBox6.Controls.Add(this.childNode);
this.groupBox6.Controls.Add(this.attribute);
this.groupBox6.Controls.Add(this.label20);
this.groupBox6.Controls.Add(this.nodeContent);
this.groupBox6.Controls.Add(this.label17);
this.groupBox6.Controls.Add(this.label19);
this.groupBox6.Controls.Add(this.label16);
this.groupBox6.Controls.Add(this.label15);
this.groupBox6.Location = new System.Drawing.Point(12, 12);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(371, 116);
this.groupBox6.TabIndex = 1310;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "節(jié)點(diǎn)一";
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(195, 45);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(53, 12);
this.label20.TabIndex = 1315;
this.label20.Text = "屬性值:";
//
// nodeContent
//
this.nodeContent.Location = new System.Drawing.Point(266, 70);
this.nodeContent.Name = "nodeContent";
this.nodeContent.Size = new System.Drawing.Size(100, 21);
this.nodeContent.TabIndex = 5;
//
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(195, 17);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(53, 12);
this.label17.TabIndex = 1310;
this.label17.Text = "子標(biāo)記:";
//
// label19
//
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(189, 76);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(65, 12);
this.label19.TabIndex = 1313;
this.label19.Text = "標(biāo)記內(nèi)容:";
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(9, 45);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(65, 12);
this.label16.TabIndex = 1311;
this.label16.Text = "屬性名稱:";
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(9, 75);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(65, 12);
this.label15.TabIndex = 1312;
this.label15.Text = "次子標(biāo)記:";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Controls.Add(this.button1);
this.groupBox2.Controls.Add(this.button7);
this.groupBox2.Font = new System.Drawing.Font("宋體", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox2.Location = new System.Drawing.Point(399, 301);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(360, 110);
this.groupBox2.TabIndex = 1312;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "操作類型";
//
// button2
//
this.button2.Location = new System.Drawing.Point(277, 37);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(63, 23);
this.button2.TabIndex = 15;
this.button2.Text = "刪除記錄";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(34, 37);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(63, 23);
this.button1.TabIndex = 14;
this.button1.Text = "添加記錄";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(158, 37);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(63, 23);
this.button7.TabIndex = 13;
this.button7.Text = "修改記錄";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(16, 21);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(53, 12);
this.label5.TabIndex = 1316;
this.label5.Text = "子標(biāo)記:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 49);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 1312;
this.label2.Text = "次子標(biāo)記:";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.textBox6);
this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.textBox5);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(14, 301);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(369, 110);
this.groupBox1.TabIndex = 1314;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "添加節(jié)點(diǎn)";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(261, 46);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 21);
this.textBox1.TabIndex = 102;
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(89, 15);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(100, 21);
this.textBox6.TabIndex = 100;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(89, 46);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 21);
this.textBox2.TabIndex = 103;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(261, 15);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(100, 21);
this.textBox3.TabIndex = 101;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(202, 49);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 12);
this.label4.TabIndex = 1315;
this.label4.Text = "屬性值:";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(89, 74);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(100, 21);
this.textBox5.TabIndex = 104;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 80);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 1313;
this.label3.Text = "標(biāo)記內(nèi)容:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(190, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 1311;
this.label1.Text = "屬性名稱:";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(17, 17);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(53, 12);
this.label9.TabIndex = 1316;
this.label9.Text = "子標(biāo)記:";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(391, 20);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(0, 12);
this.label8.TabIndex = 1309;
//
// groupBox4
//
this.groupBox4.Controls.Add(this.label9);
this.groupBox4.Controls.Add(this.label8);
this.groupBox4.Controls.Add(this.textBox7);
this.groupBox4.Controls.Add(this.button3);
this.groupBox4.Controls.Add(this.label23);
this.groupBox4.Controls.Add(this.label22);
this.groupBox4.Controls.Add(this.label21);
this.groupBox4.Controls.Add(this.label10);
this.groupBox4.Controls.Add(this.textBox11);
this.groupBox4.Controls.Add(this.textBox10);
this.groupBox4.Controls.Add(this.textBox9);
this.groupBox4.Controls.Add(this.textBox8);
this.groupBox4.Location = new System.Drawing.Point(384, 12);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(376, 116);
this.groupBox4.TabIndex = 1311;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "節(jié)點(diǎn)二";
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(90, 11);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(100, 21);
this.textBox7.TabIndex = 6;
//
// button3
//
this.button3.Location = new System.Drawing.Point(319, 80);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(51, 23);
this.button3.TabIndex = 11;
this.button3.Text = "創(chuàng)建";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(211, 45);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(53, 12);
this.label23.TabIndex = 1315;
this.label23.Text = "屬性值:";
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(13, 76);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(65, 12);
this.label22.TabIndex = 1313;
this.label22.Text = "標(biāo)記內(nèi)容:";
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(7, 45);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(65, 12);
this.label21.TabIndex = 1312;
this.label21.Text = "次子標(biāo)記:";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(199, 14);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(65, 12);
this.label10.TabIndex = 1311;
this.label10.Text = "屬性名稱:";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(90, 70);
this.textBox11.Name = "textBox11";
this.textBox11.Size = new System.Drawing.Size(100, 21);
this.textBox11.TabIndex = 10;
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(270, 11);
this.textBox10.Name = "textBox10";
this.textBox10.Size = new System.Drawing.Size(100, 21);
this.textBox10.TabIndex = 7;
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(90, 42);
this.textBox9.Name = "textBox9";
this.textBox9.Size = new System.Drawing.Size(100, 21);
this.textBox9.TabIndex = 9;
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(270, 42);
this.textBox8.Name = "textBox8";
this.textBox8.Size = new System.Drawing.Size(100, 21);
this.textBox8.TabIndex = 8;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(765, 419);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox4);
this.Name = "Form1";
this.Text = "用C#操作XML文件";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox5.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.TextBox root;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox firstNode;
private System.Windows.Forms.TextBox childNode;
private System.Windows.Forms.TextBox attribute;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.TextBox nodeContent;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox textBox11;
private System.Windows.Forms.TextBox textBox10;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.TextBox textBox8;
}
原文鏈接:https://zhima.blog.csdn.net/article/details/128358309
相關(guān)推薦
- 2023-07-24 uniapp開發(fā)小程序,包過(guò)大解決方案
- 2022-11-29 .NET中l(wèi)ambda表達(dá)式合并問(wèn)題及解決方法_實(shí)用技巧
- 2022-07-30 windows安裝matplotlib方法(cmd+pycharm)+cmd不運(yùn)行python命令解
- 2022-12-14 Jetpack?Compose?雙指拖拽實(shí)現(xiàn)詳解_Android
- 2022-09-25 Iterable,Collection和List的常見方法簽名及含義
- 2022-06-27 Python深拷貝與淺拷貝引用_python
- 2022-08-06 GIN的路由以及傳參問(wèn)題_Golang
- 2022-10-18 C++函數(shù)模板與重載解析超詳細(xì)講解_C 語(yǔ)言
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支