Common: Custom Draw Cell in catch block

This commit is contained in:
Jonathan Jenne 2021-04-21 14:31:39 +02:00
parent c0771a567f
commit 385ad98d95

View File

@ -560,24 +560,28 @@ Public Class frmDocumentResultList
End Sub End Sub
Private Sub GridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell Private Sub GridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell
If e.RowHandle < 0 Then Try
Exit Sub If e.RowHandle < 0 Then
End If Exit Sub
End If
Dim oView As GridView = TryCast(sender, GridView) e.DefaultDraw()
Dim oCellInfo As GridCellInfo = TryCast(e.Cell, GridCellInfo)
Dim oRow As DataRow = oView.GetDataRow(e.RowHandle)
Dim oValue = oRow.Item(COLUMN_FILENAME)
e.DefaultDraw() Dim oView As GridView = TryCast(sender, GridView)
Dim oCellInfo As GridCellInfo = TryCast(e.Cell, GridCellInfo)
Dim oRow As DataRow = oView.GetDataRow(e.RowHandle)
Dim oValue = oRow.Item(COLUMN_FILENAME)
If e.Column.FieldName = COLUMN_ICON Then If e.Column.FieldName = COLUMN_ICON Then
Dim oIcon = _Helpers.GetIconByExtension(oValue) Dim oIcon = _Helpers.GetIconByExtension(oValue)
Dim offsetX = 0 Dim offsetX = 0
Dim offsetY = 0 Dim offsetY = 0
e.Cache.DrawImage(oIcon, e.Bounds.X + offsetX, e.Bounds.Y + offsetY, 18, 18) e.Cache.DrawImage(oIcon, e.Bounds.X + offsetX, e.Bounds.Y + offsetY, 18, 18)
End If End If
Catch ex As Exception
_Logger.Error(ex)
End Try
End Sub End Sub
Private Function TryGetItem(DataRow As DataRow, ColumnName As String, Optional DefaultValue As String = "") As String Private Function TryGetItem(DataRow As DataRow, ColumnName As String, Optional DefaultValue As String = "") As String