惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
Engineering at Meta
Engineering at Meta
I
InfoQ
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
H
Help Net Security
博客园 - 【当耐特】
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
腾讯CDC
雷峰网
雷峰网
Martin Fowler
Martin Fowler
The GitHub Blog
The GitHub Blog
D
Docker

博客园 - 林骄

Android note 2010.08.02 v2 2010.08.03 Android note Android Note 2010.08.02 Android Note 2011.08.01 [Biztalk]问题集 - 林骄 - 博客园 Winform导出Excel Excel单元格颜色 判断系统版本 How to open a folder with explorer - 林骄 Print Can't open Infragistics help document How to get local machine date format.如何获取本机时间格式 cannot open user default database WebService Tips 中文全半角转换 Windows Service 装机备忘 Db2中的时间
ListView && XmlReader
林骄 · 2010-07-07 · via 博客园 - 林骄

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");
            lv.Columns.Add(
"Id");
            lv.Columns.Add(
"MainWindowTitle");

            ListViewItem lvItem 

= null;
            
foreach (Process process in System.Diagnostics.Process.GetProcesses())
            {
                lvItem 
= new ListViewItem();
                lvItem.Text 
= process.ProcessName;
                lvItem.SubItems.Add(process.Id);
                lvItem.SubItems.Add(process.MainWindowTitle);

                lv.Items.Add(lvItem);
            }
        }

代码

 public class CountryItem : System.Windows.Forms.ListViewItem
    {
        
public string CountryName { getset; }
        
public string CountryAbbreviation { getset; }
        
public string LastModifyTime { getset; }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 += " ) ";
                }
            }
        }