This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
64 lines (55 loc) · 2.09 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Collections
Imports DevExpress.XtraVerticalGrid.ViewInfo
Imports DevExpress.XtraVerticalGrid.Events
Imports DevExpress.XtraEditors.ViewInfo
Imports DevExpress.XtraEditors.DXErrorProvider
Namespace WindowsApplication1
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Function GetRowInfo(ByVal e As CustomDrawRowValueCellEventArgs) As BaseRowViewInfo
Dim rowsViewInfo As RowViewInfoReadOnlyCollection = propertyGridControl1.ViewInfo.RowsViewInfo
For i As Integer = 0 To rowsViewInfo.Count - 1
Dim info As BaseRowViewInfo = TryCast(rowsViewInfo(i), BaseRowViewInfo)
If info.Row.Equals(e.Row) Then
Return info
End If
Next i
Return Nothing
End Function
Public Function GetEditorViewInfo(ByVal rowInfo As BaseRowViewInfo, ByVal e As CustomDrawRowValueCellEventArgs) As BaseEditViewInfo
If rowInfo Is Nothing Then
Return Nothing
End If
For i As Integer = 0 To rowInfo.ValuesInfo.Count - 1
Dim valuesInfo As RowValueInfo = rowInfo.ValuesInfo(i)
If valuesInfo.RecordIndex = e.RecordIndex AndAlso valuesInfo.RowCellIndex = e.CellIndex Then
Return valuesInfo.EditorViewInfo
End If
Next i
Return Nothing
End Function
Private Sub propertyGridControl1_CustomDrawRowValueCell(ByVal sender As Object, ByVal e As CustomDrawRowValueCellEventArgs) Handles propertyGridControl1.CustomDrawRowValueCell
If e.CellValue IsNot Nothing Then
Return
End If
Dim rowInfo As BaseRowViewInfo = GetRowInfo(e)
Dim editViewInfo As BaseEditViewInfo = GetEditorViewInfo(rowInfo, e)
editViewInfo.ErrorIconText = "IsNull"
editViewInfo.ShowErrorIcon = True
editViewInfo.FillBackground = True
editViewInfo.ErrorIcon = DXErrorProvider.GetErrorIconInternal(ErrorType.Critical)
editViewInfo.CalcViewInfo(e.Graphics)
End Sub
End Class
End Namespace