简体   繁体   中英

Coding for a selected item in listView

I have a list view listView1 with Details veiw in my C++/CLI winform and I would like to execute a code depending on duable clicking on the current selected item in listView1 . How I can do such task?

You can listen to the doubleclick event of the ListView and check what item was under the cursor (if any) like:

void listView1_MouseDoubleClick(Object^  sender, MouseEventArgs^  e) 
{
     ListViewItem^ item = this->listView1->GetItemAt(e->X, e->Y);
}

You can also use ItemActivate event (while Activation property is set to ItemActivation.DoubleClick ). Then you can set up everything from designer.

You can check out Better ListView Express , a free WinForms component with many aspects of the original ListView improved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM