



















ListView:
It's a very good control. The book just introduce it samply.
代码
private void BindListView()
{
lv.GridLines = true;
lv.LabelEdit = true;
lv.AllowColumnReorder = true;
//lv.CheckBoxes = true;
lv.FullRowSelect = true;
lv.Sorting = SortOrder.Ascending;
lv.Columns.Add(
"ProcessName");ListViewItem lvItem
= null; lv.Items.Add(lvItem);
}
}
代码
public class CountryItem : System.Windows.Forms.ListViewItem
{
public string CountryName { get; set; }
public string CountryAbbreviation { get; set; }
public string LastModifyTime { get; set; }public CountryItem(string countryName, string countryAbbreviation,
string currency, string lastModifyTime)
{
this.CountryName = countryName;
this.CountryAbbreviation = countryAbbreviation;
this.LastModifyTime = lastModifyTime;
base.Text = countryName;
base.SubItems.Add(currency);
base.SubItems.Add(lastModifyTime);
}
}
XmlReader:
代码
private void TestXml()
{
XmlReader rdr = XmlReader.Create("Favorites.xml");
while (rdr.Read())
{
if (rdr.NodeType == XmlNodeType.Element)
{
this.txtMsg.Text += rdr.Name + "\n\t" + " ( ";
for (int i = 0; i < rdr.AttributeCount; i++)
{
rdr.MoveToAttribute(i);
this.txtMsg.Text += rdr.Name + ":" + rdr.Value + ";";
}
this.txtMsg.Text += " ) ";
}
}
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。