b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

datagridview 线_datagridview显示数据_datagridview绑定list(11)

电脑杂谈  发布时间:2017-05-30 16:01:59  来源:网络整理

e.ContextMenuStrip = this.ContextMenuStrip2;

}

else if (dgv[e.ColumnIndex, e.RowIndex].Value is int)

{

//如果单元格值是整数时

e.ContextMenuStrip = this.ContextMenuStrip3;

}

}

同样,可以通过RowContextMenuStripNeeded事件来设定行的右键菜单。

//RowContextMenuStripNeeded事件处理方法

private void DataGridView1_RowContextMenuStripNeeded(object sender,

DataGridViewRowContextMenuStripNeededEventArgs e)

{

DataGridView dgv = (DataGridView)sender;

//当"Column1"列是Bool型且为True时、设定其的ContextMenuStrip

object boolVal = dgv["Column1", e.RowIndex].Value;

Console.WriteLine(boolVal);

if (boolVal is bool && (bool)boolVal)

{

e.ContextMenuStrip = this.ContextMenuStrip1;

}

}

CellContextMenuStripNeeded事件处理方法的参数中、「e.ColumnIndex=-1」表示行头、「e.RowIndex=-1」表示列头。RowContextMenuStripNeeded则不存在「e.RowIndex=-1」的情况。

四、针对触发事件的一些介绍


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-50130-11.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...