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,17 +560,18 @@ Public Class frmDocumentResultList
End Sub
Private Sub GridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell
Try
If e.RowHandle < 0 Then
Exit Sub
End If
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)
e.DefaultDraw()
If e.Column.FieldName = COLUMN_ICON Then
Dim oIcon = _Helpers.GetIconByExtension(oValue)
Dim offsetX = 0
@ -578,6 +579,9 @@ Public Class frmDocumentResultList
e.Cache.DrawImage(oIcon, e.Bounds.X + offsetX, e.Bounds.Y + offsetY, 18, 18)
End If
Catch ex As Exception
_Logger.Error(ex)
End Try
End Sub
Private Function TryGetItem(DataRow As DataRow, ColumnName As String, Optional DefaultValue As String = "") As String