【问题标题】:visual c++ dataGridView cellclick eventvisual c++ dataGridView cellclick事件
【发布时间】:2019-01-25 18:34:41
【问题描述】:

我在dataGridView 中搜索了cellclick 事件c++。所有结果都是关于c#.
我的dataGridView1 选择模式是FullRowSelect。我的目标是当我单击任何单元格(行)时,检测该行并执行某些操作。

int i;
private: System::Void dataGridView1_CellDoubleClick(System::Object^  sender, System::Windows::Forms::DataGridViewCellEventArgs^  e)
{
   if (double clicked row 1)
   { 
      int = 1;
   }
   if (double clicked row 2)
   {
      int = 2;
   }
}

我需要任何简单的示例或任何学习资源。谢谢。

【问题讨论】:

    标签: visual-studio visual-c++ datagridview c++-cli clr


    【解决方案1】:

    好的,在c#教程上找到了解决方案并转换为c++-clr

        if (e->RowIndex == 1) //that's what i looking for, you can use ColumnIndex too.
    {
        int = 1;
    }
    

    非常适合 c++-clr。

    msdn 上的 DataGridViewCell.RowIndex 属性也有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-25
      • 1970-01-01
      • 2015-01-13
      • 2013-12-05
      • 2019-09-24
      • 2017-08-16
      • 2012-01-15
      相关资源
      最近更新 更多