These are the following properties and events of ListView:
this.listView1.LargeImageList = this.imageList1;
this.listView1.HoverSelection = true; //When mouse goes on list item then its highlight.
this.listView1.Activation = System.Windows.Forms.ItemActivation.OneClick; //When mouse goes on list time then cursor convert into hand.
this.listView1.Sorting = System.Windows.Forms.SortOrder.Ascending; // List Items arrange accordingly Items name
//Add items into List View
String FilePath = openFileDialog1.FileName;
imageList1.Images.Add(Image.FromFile(FilePath));
ListViewItem listItem = new ListViewItem(filename,imageList1.Images.Count - 1);
listView1.Items.Add(listItem);
private void listView1_Click(object sender, EventArgs e)
{
for (int i = 0; i < listView1.Items.Count; i++)
if (listView1.Items[i].Selected)
MessageBox.Show(listView1.Items[i].Text + " - " + (i + 1).ToString());
}
Take help from this site for examples on ListView: http://www.java2s.com/Code/CSharp/GUI-Windows-Form/ListViewExample.htm
this.listView1.LargeImageList = this.imageList1;
this.listView1.HoverSelection = true; //When mouse goes on list item then its highlight.
this.listView1.Activation = System.Windows.Forms.ItemActivation.OneClick; //When mouse goes on list time then cursor convert into hand.
this.listView1.Sorting = System.Windows.Forms.SortOrder.Ascending; // List Items arrange accordingly Items name
//Add items into List View
String FilePath = openFileDialog1.FileName;
imageList1.Images.Add(Image.FromFile(FilePath));
ListViewItem listItem = new ListViewItem(filename,imageList1.Images.Count - 1);
listView1.Items.Add(listItem);
private void listView1_Click(object sender, EventArgs e)
{
for (int i = 0; i < listView1.Items.Count; i++)
if (listView1.Items[i].Selected)
MessageBox.Show(listView1.Items[i].Text + " - " + (i + 1).ToString());
}
Take help from this site for examples on ListView: http://www.java2s.com/Code/CSharp/GUI-Windows-Form/ListViewExample.htm
No comments:
Post a Comment