C# DataGridView 单元格按钮点击事件CellContentClick
C# 全选
this.gridAttachFiles.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.gridAttachFiles_CellContentClick);
C# 全选
private void gridAttachFiles_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
//点击button按钮事件
if (gridAttachFiles.Columns[e.ColumnIndex].Name == "btnOpenFile" && e.RowIndex >= 0)
{
//当前行
var file = gridAttachFiles.Rows[e.RowIndex].DataBoundItem as WorkflowNodeFiles;
if (file != null)
{
if (ImageHelper.IsImageType(file.FileType))
{
var image = ImageHelper.FromBytes(file.FileData);
frmPictureViewer.ShowImage(image);
}
else
{
FileHelper.OpenFile(file.FileName, file.FileType, file.FileData);
}
}
}
}
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网