listView1.View = View.Details; listView1.Columns.Add("File type", 20, HorizontalAlignment.Left); 
1.    using System;
2.    using System.Drawing; 
3.    using System.Collections; 
4.    using System.ComponentModel; 
5.    using System.Windows.Forms; 
6.
7.    namespace PocketDice 
8.    { 
9.    // 涨岿֣ʡ 
10.        public class frmHighScores:System.Windows.Forms.Form 
11.        { 
12.            private System.Windows.Forms.ListView listScores; 
13.            private System.Windows.Forms.ColumnHeader cName; 
14.            private System.Windows.Forms.ColumnHeader cScore; 
15.            private System.Windows.Forms.ColumnHeader cDate; 
16.            private System.Windows.Forms.Button btnClear; 
17.            private System.Windows.Forms.Button btnOK; 
18.
19.            private Data _data; 
20.            private int _indexHighlight = -1; 
21.
22.            public frmHighScores(Data data) 
23.            { 
24.            // 
25.            // Ҫ֧Windows Form Designer 
26.            // 
27.            InitializeComponent(); 
28.
29.            // 
30.            // TODO:InitializeComponentúй
31.            // 
32.
33.          _data = data; 
34.        } 
35.
36.        public frmHighScores(Data data, int indexHighlight)
:this(data) 
37.        { 
38.              _indexHighlight = indexHighlight; 
39.        } 
40.
41.
42.        /// <summary> 
43.        /// ùԴ 
44.        /// </summary> 
45.        protected override void Dispose( bool disposing ) 
46.        { 
47.            base.Dispose( disposing ); 
48.        } 
49.
50.        #region Windows Form Designer generated code 
51.        private void InitializeComponent() 
52.        { 

53.            System.Resources.ResourceManager resources = new 
System.Resources.ResourceManager(typeof(frmHighScores)); 
54.            this.listScores = new System.Windows.Forms.ListView(); 
55.this.cName = new System.Windows.Forms.ColumnHeader(); 
56.            this.cScore = new System.Windows.Forms.ColumnHeader(); 
57.            this.cDate = new System.Windows.Forms.ColumnHeader(); 
58.            this.btnClear = new System.Windows.Forms.Button(); 
59.            this.btnOK = new System.Windows.Forms.Button(); 
60.            // 
61.            // listScores 
62.            // 
63.            this.listScores.Columns.Add(this.cName); 
64.            this.listScores.Columns.Add(this.cScore); 
65.            this.listScores.Columns.Add(this.cDate); 
66.            this.listScores.HeaderStyle = 
System.Windows.Forms.ColumnHeaderStyle.Nonclickable; 
67.            this.listScores.Location = new System.Drawing.Point(8, 8); 
68.            this.listScores.Size = new System.Drawing.Size(224, 184); 
69.            this.listScores.View = System.Windows.Forms.
View.Details; 
70.            // 
71.            // cName 
72.            // 
73.            this.cName.Text = "Name"; 
74.            this.cName.Width = 90; 
75.            // 
76.            // cScore 
77.            // 
78.            this.cScore.Text = "Score"; 
79.            this.cScore.TextAlign = 
System.Windows.Forms.HorizontalAlignment.Center; 
80.            this.cScore.Width = 54; 
81.            // 
82.            // cDate 
83.            // 
84.            this.cDate.Text = "Date"; 
85.            this.cDate.TextAlign = 
System.Windows.Forms.HorizontalAlignment.Center; 
86.            this.cDate.Width = 78; 
87.            // 
88.            // btnClear 
89.            // 
90.            this.btnClear.Location = new System.Drawing.Point
(16, 208); 
91.            this.btnClear.Size = new System.Drawing.Size(96, 24); 
92.            this.btnClear.Text = "Clear Scores..."; 
93.            this.btnClear.Click += new 
System.EventHandler(this.btnClear_Click); 
94.            // 
95.            // btnOK 
96.            // 
97.            this.btnOK.Location = new System.Drawing.Point(168, 208); 
98.            this.btnOK.Size = new System.Drawing.Size(56, 24); 
99.            this.btnOK.Text = "OK"; 
100.            this.btnOK.Click += new 
System.EventHandler(this.btnOK_Click); 
101.            // 
102.            // frmHighScores 
103.            // 
104.            this.Controls.Add(this.btnOK); 
105.            this.Controls.Add(this.btnClear); 
106.            this.Controls.Add(this.listScores); 
107.            this.Icon = 
((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 
108.            this.MaximizeBox = false; 
109.            this.MinimizeBox = false; 
110.            this.Text = "High Scores"; 
111.            this.Load += new 
System.EventHandler(this.frmHighScores_Load); 
112.    
113.        } 
114.        #endregion 
115.
116.        private void frmHighScores_Load(object sender, 
System.EventArgs e) 
117.        { 
118.        // ñ߷б 
119.        for (int i=0; i<_data.HighScores.Length; i++) 
120.        { 
121.        if (_data.HighScores[i].Score != -1) 
122.        { 
123.                // ӷб
124.                    ListViewItem li = new ListViewItem(new string[] 
{_data.HighScores[i].Name, _data.HighScores[i].Score.ToString(), 
_data.HighScores[i].Date.ToShortDateString() } ); 
125.                    this.listScores.Items.Insert
(listScores.Items.Count, li); 
126.
127.                // ѡȥƥ? 
128.                if (i == _indexHighlight) 
129.                { 
130.                    this.listScores.Items[i].Selected = true; 
131.                } 
132.            } 
133.        } 
134.    } 
135.
136.    private void btnOK_Click(object sender, System.EventArgs e) 
137.    { 
138.        this.Close(); 
139.    } 
140.
141.     private void btnClear_Click(object sender, System.EventArgs e) 
142.          {
143.              if (MessageBox.Show(
144.                  "Are you sure you want to clear all high scores?"
145.                  , "Confirm"
146.                  , MessageBoxButtons.OKCancel
147.                  , MessageBoxIcon.Question  
148.                  , MessageBoxDefaultButton.Button2) == 
DialogResult.OK)  
149.              {  
150.                  _data.ClearHighScores();  
151.                  this.listScores.Items.Clear();
152.              }  
153.      
154.          }  
155.     }  
156.  }  
