Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I tried to reproduce your problem as far as I could. I think I can help you out with at least two of the three issues you've listed.</p> <blockquote> <p><em><strong>1. The item in the list view is not always properly selected. In other words, when the item is selected, a detail string value is displayed in a label control.</strong></em></p> </blockquote> <p>You can be notified when an item has been selected via the <code>ListView.ItemSelectionChanged</code> event:</p> <pre><code>// // this handler's only responsibility is updating the item info label: // void lstModules_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (e.IsSelected) { // an item has been selected; update the label, e.g.: lblModuleDetails.Text = e.Item.Text; } else { // some item has been de-selected; clear the label: lblModuleDetails.Text = string.Empty; } } </code></pre> <blockquote> <p><em><strong>3. Context menu location briefly appears at the old mouse location then moves to the new mouse location.</strong></em></p> </blockquote> <p>I believe you try to do too much. Let the framework handle the displaying of the context menu which you have specified via the <code>ListView.ContextMenuStrip</code> property. The effect you experience is caused by your manually calling <code>ContextMenuStrip.Show(...)</code>, which results in the displaying of the context menu by the framework, and then you doing the same thing a second time, at another location.</p> <p>Therefore, try not to call this function; the context menu should still appear.</p> <pre><code>// // this handler's only responsibility is setting the correct context menu: // void lstModules_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var hitTest = lstModules.HitTest(e.Location); if (hitTest != null &amp;&amp; hitTest.Item != null) { lstModules.ContextMenuStrip = mnuContext_Module; } else { lstModules.ContextMenuStrip = mnuContext_Desktop; } } } </code></pre> <p>Btw., if that works, you can also get rid of your <code>lstModules_MouseMove</code> event handler and the <code>mouse</code> location object.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload