Home >Backend Development >C#.Net Tutorial >C# Get the Item case under the mouse of ListView

C# Get the Item case under the mouse of ListView

黄舟
黄舟Original
2017-03-27 11:41:471618browse

The following editor will bring you an articleC#GetListView the Item instance under the mouse. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor to take a look.

In ListView in virtual mode, CheckBox cannot be clicked. You can use this method to achieve it

private void lvwTitle_MouseDown(object sender, MouseEventArgs e)

    {
      Point curPos = this.lvwTitle.PointToClient(Control.MousePosition);
      ListViewItem lvwItem = this.lvwTitle.GetItemAt(curPos.X, curPos.Y);


      if (lvwItem != null)
      {
        lvwItem.Checked = !lvwItem.Checked;
        lvwTitle.Refresh();
      } 
      
    }

The above is the detailed content of C# Get the Item case under the mouse of ListView. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn