ListView loses Focus the selected row does not highlight the issue
The HideSelection property of the ListView is set to true.
1 PublicForm1 ()2 {3 InitializeComponent ();4 5 //Display Style6Listview1.view =View.LargeIcon;7Listview1.largeimagelist =ImageList1;8 9 //prohibit multiple selectionTenListview1.multiselect =false; One A //Add Item -LISTVIEW1.ITEMS.ADD ("aaaaaa"); -LISTVIEW1.ITEMS.ADD ("bbbbbbb"); the -listview1.items[0]. ImageIndex =0; -listview1.items[1]. ImageIndex =0; - + } - + Private voidForm1_Load (Objectsender, EventArgs e) A { at //Select an item -listview1.items[1]. Selected =true; -listview1.items[0]. EnsureVisible (); -Listview1.select ();//activating the control - - in } - to Private voidButton1_Click (Objectsender, EventArgs e) + { - stringstr = listview1.selecteditems[0]. Text; the * MessageBox.Show (str); $ }Panax Notoginseng - the + Private voidListview1_click (Objectsender, EventArgs e) A { the stringstr = listview1.selecteditems[0]. Text; + - MessageBox.Show (str); $ $}
C # ListView