您好,欢迎光临本网站![请登录][注册会员]  
文件名称: C#程序设计《学生信息显示》
  所属分类: 专业指导
  开发工具:
  文件大小: 152kb
  下载次数: 0
  上传时间: 2011-05-28
  提 供 者: woaizhu*******
 详细说明: C#学生信息显示 namespace xuexi6._ { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public student[] sts = new student[10]; private void initializestudent() { student st0 = new student(); st0.Name = "赵阳"; st0.Sex = "男"; st0.Jiguan = "嘉兴"; st0.Banji = "计算机一班"; sts[0] = st0; student st1 = new student(); s t1.Name = "蒋林杰"; st1.Sex = "男"; st1.Jiguan = "宁波"; st1.Banji = "计算机一班"; sts[1] = st1; student st2 = new student(); st2.Name = "邱明峰"; st2.Sex = "男"; st2.Jiguan = "杭州"; st2.Banji = "计算机一班"; sts[2] = st2; student st3 = new student(); st3.Name = "陆玲燕"; st3.Sex = "女"; st3.Jiguan = "丽水"; st3.Banji = "计算机一班"; sts[3] = st3; student st4 = new student(); st4.Name = "邵德华"; st4.Sex = "男"; st4.Jiguan = "台州"; st4.Banji = "计算机二班"; sts[4] = st4; student st5 = new student(); st5.Name = "吴旦"; st5.Sex = "女"; st5.Jiguan = "温州"; st5.Banji = "计算机二班"; sts[5] = st5; student st6 = new student(); st6.Name = "朱凤"; st6.Sex = "女"; st6.Jiguan = "绍兴"; st6.Banji = "计算机三班"; sts[6] = st6; student st7 = new student(); st7.Name = "邱小峰"; st7.Sex = "男"; st7.Jiguan = "湖州"; st7.Banji = "计算机三班"; sts[7] = st7; student st8 = new student(); st8.Name = "沈汉卿"; st8.Sex = "男"; st8.Jiguan = "衡州"; st8.Banji = "计算机三班"; sts[8] = st8; student st9 = new student(); st9.Name = "王佳俊"; st9.Sex = "男"; st9.Jiguan = "义乌"; st9.Banji = "计算机三班"; sts[9] = st9; } private void initializetvstudent() { TreeNode firsttn = new TreeNode("学生信息"); TreeNode secondtn1 = new TreeNode(sts[0].Banji); secondtn1.Nodes.Add(sts[0].Name); secondtn1.Nodes.Add(sts[1].Name); secondtn1.Nodes.Add(sts[2].Name); secondtn1.Nodes.Add(sts[3].Name); TreeNode secondtn2 = new TreeNode(sts[4].Banji); secondtn2.Nodes.Add(sts[4].Name); secondtn2.Nodes.Add(sts[5].Name); TreeNode secondtn3 = new TreeNode(sts[6].Banji); secondtn3.Nodes.Add(sts[6].Name); secondtn3.Nodes.Add(sts[7].Name); secondtn3.Nodes.Add(sts[8].Name); secondtn3.Nodes.Add(sts[9].Name); firsttn.Nodes.AddRange(new TreeNode[] { secondtn1, secondtn2, secondtn3 }); tvstudent.Nodes.Add(firsttn); } private void initializelvstudent() { ColumnHeader column1 = new ColumnHeader(); column1.Text = "姓名"; lvstudent.Columns.Add(column1); ColumnHeader column2 = new ColumnHeader(); column2.Text = "性别"; lvstudent.Columns.Add(column2); ColumnHeader column3 = new ColumnHeader(); column3.Text = "籍贯"; lvstudent.Columns.Add(column3); ColumnHeader column4 = new ColumnHeader(); column4.Text = "班级"; lvstudent.Columns.Add(column4); for (int i = 0; i < sts.Length; i++) { ListViewItem lvi = new ListViewItem(); lvi.Text = sts[i].Name; lvi.SubItems.Add(sts[i].Sex); lvi.SubItems.Add(sts[i].Jiguan); lvi.SubItems.Add(sts[i].Banji); lvstudent.Items.Add(lvi); } } private void tvstudentadd(int i) { ListViewItem lvi = new ListViewItem(); lvi.Text = sts[i].Name; lvi.SubItems.Add(sts[i].Sex); lvi.SubItems.Add(sts[i].Jiguan); lvi.SubItems.Add(sts[i].Banji); lvi.ImageIndex = i; lvstudent.Items.Add(lvi); } private void Form1_Load(object sender, EventArgs e) { initializestudent(); initializetvstudent(); initializelvstudent(); } private void tvstudent_AfterSelect(object sender, TreeViewEventArgs e) { lvstudent.Items.Clear(); if (e.Node.Text == "学生信息") { for (int i = 0; i < sts.Length; i++) { tvstudentadd(i); } } else if (e.Node.Text == "计算机一班") { for (int i = 0; i < sts.Length; i++) { if (sts[i].Banji == e.Node.Text) { tvstudentadd(i); } } } else if (e.Node.Text == "计算机二班") { for (int i = 0; i < sts.Length; i++) { if (sts[i].Banji == e.Node.Text) { tvstudentadd(i); } } } else if (e.Node.Text == "计算机三班") { for (int i = 0; i < sts.Length; i++) { if (sts[i].Banji == e.Node.Text) { tvstudentadd(i); } } } else { for (int i = 0; i < sts.Length; i++) { if (sts[i].Name == e.Node.Text) { tvstudentadd(i); } } } } public class student { private string name; private string sex; private string jiguan; private string banji; public string Name { get { return name; } set { name = value; } } public string Sex { get { return sex; } set { sex = value; } } public string Jiguan { get { return jiguan; } set { jiguan = value; } } public string Banji { get { return banji; } set { banji = value; } } } private void lvstudent_ItemActivate(object sender, EventArgs e) { MessageBox.Show("您选择的是:" + lvstudent.SelectedItems[0].Text); } private void btnlargeicon_Click(object sender, EventArgs e) { lvstudent.View = View.LargeIcon; } private void btnsmallicon_Click(object sender, EventArgs e) { lvstudent.View = View.SmallIcon; } private void btndetail_Click(object sender, EventArgs e) { lvstudent.View = View.Details; } private void btnlist_Click(object sender, EventArgs e) { lvstudent.View = View.List; } private void btntitle_Click(object sender, EventArgs e) { lvstudent.View = View.Tile; } } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 输入关键字,在本站1000多万海量源码库中尽情搜索: