![](/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.