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
Private Sub GridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell
If e.RowHandle < 0 Then
Exit Sub
End If
Try
If e.RowHandle < 0 Then
Exit Sub
End If
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()
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
Dim oIcon = _Helpers.GetIconByExtension(oValue)
Dim offsetX = 0
Dim offsetY = 0
If e.Column.FieldName = COLUMN_ICON Then
Dim oIcon = _Helpers.GetIconByExtension(oValue)
Dim offsetX = 0
Dim offsetY = 0
e.Cache.DrawImage(oIcon, e.Bounds.X + offsetX, e.Bounds.Y + offsetY, 18, 18)
End If
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