我想使用鼠标右键单击处理列表视图中的特定单元格。 [英] I want to deal with a particular cell in a listview using mouse right-clicks.

查看:80
本文介绍了我想使用鼠标右键单击处理列表视图中的特定单元格。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨:

我有一个listview并且我喜欢它,以便当用户右键单击其中一个单元格时(我的意思是单元格:某些列与之间的交叉点)某一行),它会显示一个上下文,其中包含用户可以在该特定单元格上执行的一些选项或任务。

所以我的问题是如何在右键单击时引用该特定单元格。

请帮帮我。

Hi:
I have a listview and I'd like it so that when the user right-clicks on one of the cells(I mean by the cell: the intersection field between certain column with a certain row), it would bring up a contextmenustrip with a few options or tasks the user could perform on that particular cell.
So my question is how to refer to that particular cell when right-clicks.
Help me please.

推荐答案

private void listView1_MouseClick(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Right)
    {
        if (listView1.FocusedItem.Bounds.Contains(e.Location) == true)
        {
            contextMenuStrip1.Show(Cursor.Position);
        }
    }
}


这篇关于我想使用鼠标右键单击处理列表视图中的特定单元格。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆