This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
Form1.vb
78 lines (68 loc) · 2.35 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
Namespace WindowsFormsApplication1
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Dim list As New BindingList(Of MyObject)()
Dim random As New Random()
For i As Integer = 0 To 99
list.Add(New MyObject(random.Next(1000), i.ToString()))
Next i
gridControl1.DataSource = list
gridControl1.ForceInitialize()
gridView1.PreviewFieldName = "Description"
gridView1.OptionsView.ShowPreview = True
Dim condition As New StyleFormatCondition(FormatConditionEnum.Greater, gridView1.Columns("Number"), Nothing, 300, Nothing, True)
condition.Appearance.BackColor = Color.Green
gridView1.FormatConditions.Add(condition)
AddHandler gridView1.CustomDrawRowPreview, AddressOf gridView1_CustomDrawRowPreview
End Sub
Private Sub gridView1_CustomDrawRowPreview(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs)
e.Appearance.Assign((TryCast(e.Info, GridDataRowInfo)).Appearance)
End Sub
End Class
Public Class MyObject
Public Sub New()
End Sub
''' <summary>
''' Initializes a new instance of the MyClass class.
''' </summary>
''' <param name="number"></param>
''' <param name="description"></param>
Public Sub New(ByVal number As Integer, ByVal description As String)
_Number = number
_Description = description
End Sub
Private _Number As Integer
Public Property Number() As Integer
Get
Return _Number
End Get
Set(ByVal value As Integer)
_Number = value
End Set
End Property
Private _Description As String
Public Property Description() As String
Get
Return _Description
End Get
Set(ByVal value As String)
_Description = value
End Set
End Property
End Class
End Namespace