![](/img/trans.png)
[英]Show multiple image in gridview and then link each image from gridview that open in new tab as large individually
[英]Iterating through GridView Rows and setting image individually
我有一个名为TEST的Devexpress DataGridView.A列设置为使用RepositoryItemTextEdit
显示图像
RepositoryItemTextEdit te = new RepositoryItemTextEdit();
_grd.RepositoryItems.Add(te);
_rgv.Columns["TEST"].ColumnEdit = te;
te.ContextImage = myimage;
此代码设置列中所有单元格的图像。如何在循环中单独编辑单元格图像?
处理CustomDrawCell
事件。
private void _grd_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) {
if (e.Column.FieldName == "TEST") {
var te = (e.Cell as GridCellInfo).ViewInfo as TextEditViewInfo;
te.ContextImage = GetCustomImageForThisRow(); // <-- your custom logic
}
}
如果您的图像数量有限,我建议您创建一些存储库项目,并在GridView中有条件地将它们分配给单元格。 CustomRowCellEdit事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.