資源簡介
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?System.xml;
namespace?xml生成按鈕操作
{
????public?partial?class?Form1?:?Form
????{
????????Boolean?bis?=?false;
????????TextBox[]?Ptexbox?=?new?TextBox[6];
????????Button[]?Savebtn?=?new?Button[6];
????????Button[]?Movbtn?=?new?Button[6];
????????int?textSposX?=?102;
????????int?TextOfposY?=?55;
????????public?xmlDocument?xmldoc?=?new?xmlDocument();
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?button8_Click(object?sender?EventArgs?e)
????????{
????????????xmlCreate_Poss();
????????}
????????private?void?button7_Click(object?sender?EventArgs?e)
????????{
????????????xmlDocument?doc?=?new?xmlDocument();
????????????doc?=?new?xmlDocument();
????????????doc.Load(Application.StartupPath?+?“/Poss.xml“);
????????????FillTexrtext();
????????}
????????public?void?xmlCreate_Poss()
????????{
????????????//?存在文件?--刪除
????????????if?(System.IO.File.Exists(Application.StartupPath?+?“/Poss.xml“))
????????????{
????????????????System.IO.File.Delete((Application.StartupPath?+?“/Poss.xml“));
????????????????System.Threading.Thread.Sleep(500);
????????????}
????????????xmlDocument?doc?=?new?xmlDocument();
????????????xmlDeclaration?dec?=?doc.CreatexmlDeclaration(“1.0“?“utf-8“?“yes“);
????????????doc.AppendChild(dec);
????????????xmlElement?items?=?doc.CreateElement(“Poss“);
????????????doc.AppendChild(items);
????????????xmlElement[]?Possp?=?new?xmlElement[6];
????????????xmlElement[]?PosValue?=?new?xmlElement[6];
????????????xmlElement[]?savebtn?=?new?xmlElement[6];
????????????xmlElement[]?movbtn?=?new?xmlElement[6];
????????????for?(int?i?=?0;?i?6;?i++)
????????????{
????????????????Possp[i]?=?doc.CreateElement(“Pos“);//創建節點
????????????????Possp[i].SetAttribute(“Name“?(“Pos“?+?Convert.ToString(i)));
????????????????PosValue[i]?=?doc.CreateElement(“Posvalue“);
????????????????PosValue[i].InnerText?=?“4.58“;
????????????????Possp[i].AppendChild(PosValue[i]);//添加節點屬性1
????????????????savebtn[i]?=?doc.CreateElement(“Savebt“);
????????????????savebtn[i].InnerText?=?“Savebt“?+?Convert.ToString(i);
????????????????Possp[i].AppendChild(savebtn[i]);//添加節點屬性2
????????????????movbtn[i]?=?doc.CreateElement(“Movebt“);
????????????????movbtn[i].InnerText?=?“Movebt“?+?Convert.ToString(i);
????????????????Possp[i].AppendChild(movbtn[i]);//添加節點屬性3
????????????????items.AppendChild(Possp[i]);
????????????}
????????????doc.Save(Application.StartupPath?+?“/Poss.xml“);//保存xml
????????}
????????private?void?FillTexrtext()
????????{
????????????int?k?=?0;
????????????string?str1?=?“Pos0“;
????????????xmlDocument?doc?=?new?xmlDocument();
????????????doc.Load(Application.StartupPath?+?“/Poss.xml“);
????????????foreac
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????45568??2020-06-22?09:08??xm
?????文件????????189??2020-06-19?13:21??xm
?????文件????????800??2020-06-22?09:03??xm
?????文件??????13312??2020-06-22?09:02??xm
?????文件????????189??2020-06-19?13:21??xm
?????文件??????26112??2020-06-22?09:02??xm
?????文件??????22696??2020-06-22?09:04??xm
?????文件????????189??2020-06-19?13:21??xm
?????文件????????490??2019-03-19?12:46??xm
?????文件???????9945??2020-06-22?09:08??xm
?????文件???????2889??2020-06-19?22:26??xm
?????文件???????5817??2020-06-19?22:26??xm
?????文件???????1464??2020-06-19?20:22??xm
?????文件???????7220??2020-06-19?13:22??xm
?????文件??????????0??2020-06-19?13:21??xm
?????文件??????????0??2020-06-19?13:21??xm
?????文件??????????0??2020-06-19?13:21??xm
?????文件????????942??2020-06-22?09:04??xm
?????文件???????1012??2020-06-19?22:26??xm
?????文件???????2384??2020-06-19?14:36??xm
?????文件??????13312??2020-06-22?09:02??xm
?????文件????????180??2020-06-19?22:26??xm
?????文件??????26112??2020-06-22?09:02??xm
?????文件????????180??2020-06-19?14:36??xm
?????文件????????533??2020-06-19?13:21??xm
?????文件???????1350??2020-06-19?13:21??xm
?????文件???????2855??2020-06-19?13:21??xm
?????文件???????5612??2020-06-19?13:21??xm
?????文件???????1108??2020-06-19?13:21??xm
?????文件????????249??2020-06-19?13:21??xm
............此處省略16個文件信息
- 上一篇:C#安捷倫示波器編程控制
- 下一篇:Memcached進程監控
評論
共有 條評論