标签:
1.关于登陆部分
this.DialogResult = DialogResult.OK; this.Close(); FrmLogin login = new FrmLogin(m_CurUser); if (login.ShowDialog() == DialogResult.Cancel) { Application.Exit(); } else { }
2.listView与imageList
List<string> imageLists = new List<string>(); //下面是绑定图片数据 imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\8.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\8.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\8.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\8.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\8.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\8.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\8.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\7.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\7.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\7.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\8.jpg"); imageLists.Add("C:\\Users\\Administrator\\Desktop\\Roboter\\8.jpg"); for (int i = 0; i < imageLists.Count; i++) { //将imageList1绑定数据 imageList1.Images.Add(System.Drawing.Image.FromFile(imageLists[i].ToString())); listView1.Items.Add(System.IO.Path.GetFileName(imageLists[i].ToString()), i); listView1.Items[i].ImageIndex = i; listView1.Items[i].Name = imageLists[i].ToString(); }
选择ItemList执行事件
private void listView1_MouseClick(object sender, MouseEventArgs e) { this.listView1.SelectedItems[0].Text = "2"; this.listView1.SelectedItems[0].ImageIndex = 10; //imageList1.Images[1]. // MessageBox.Show(this.listView1.SelectedItems[0].ImageIndex.ToString()); // imageList1.Images[0] }
标签:
原文地址:http://www.cnblogs.com/wangzhenghua/p/4386432.html