简体   繁体   English

C#datagridview鼠标单击事件仅某些列

[英]C# datagridview mouse click event only certain column

I have working code on a datagridview mouse click event but ı want to working this code clicking only third columns of datagridview . 我在datagridview鼠标单击事件上有有效的代码,但是我想仅在datagridview的第三列上单击才能工作此代码。 Can you help me 你能帮助我吗

Although you haven't provided any details, maybe this code helps you to get some hints: 尽管您未提供任何详细信息,但也许此代码可以帮助您获得一些提示:

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 2) // third-column 
            {
                // when third cell clicked
            }
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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