listview:
1 //每一列的列名用Columns集合添加 2 ListViewItem lv = new ListViewItem(); 3 lv.Text = s.Code.ToString();//每一行的第一列的项通过text添加 4 lv.SubItems.Add(s.Name);//每一行的其他列的项通过SubItems集合添加 5 lv.SubItems.Add(s.Sex); 6 lv.SubItems.Add(s.Birthday.ToString("yyyy年MM月dd日")); 7 lv.SubItems.Add(s.Score.ToString("#.##")); 8 listView1.Items.Add(lv);//每一行用Items集合添加,添加的数据是上面每一项的值
简单的记事本操作:
1 private void 退出XToolStripMenuItem_Click(object sender, EventArgs e) 2 { 3 this.Close(); 4 } 5 6 private void 撤消UToolStripMenuItem_Click(object sender, EventArgs e) 7 { 8 textBox1.Undo(); 9 } 10 11 private void 剪切TToolStripMenuItem_Click(object sender, EventArgs e) 12 { 13 textBox1.Cut(); 14 } 15 16 private void 复制CToolStripMenuItem_Click(object sender, EventArgs e) 17 { 18 textBox1.Copy(); 19 } 20 21 private void 粘贴PToolStripMenuItem_Click(object sender, EventArgs e) 22 { 23 textBox1.Paste(); 24 } 25 26 private void 全选AToolStripMenuItem_Click(object sender, EventArgs e) 27 { 28 textBox1.SelectAll(); 29 }
时间: 2024-12-06 07:11:50