-
Notifications
You must be signed in to change notification settings - Fork 3
/
Main.vb
42 lines (36 loc) · 1.59 KB
/
Main.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
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.Utils.Paint
Imports DevExpress.XtraEditors
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Views.Grid
Namespace DXSample
Partial Public Class Main
Inherits XtraForm
Public Sub New()
InitializeComponent()
End Sub
Private Sub OnLoad(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
recordBindingSource.DataSource = DataHelper.GetData(10)
End Sub
Private Sub gridView1_CustomDrawCell(ByVal sender As Object, ByVal e As RowCellCustomDrawEventArgs) Handles gridView1.CustomDrawCell
Dim view As GridView = DirectCast(sender, GridView)
If Not view.OptionsView.ShowAutoFilterRow OrElse Not view.IsDataRow(e.RowHandle) Then
Return
End If
Dim filterCellText As String = view.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, e.Column)
If String.IsNullOrEmpty(filterCellText) Then
Return
End If
Dim filterTextIndex As Integer = e.DisplayText.IndexOf(filterCellText, StringComparison.CurrentCultureIgnoreCase)
If filterTextIndex = -1 Then
Return
End If
e.Appearance.FillRectangle(e.Cache, e.Bounds)
e.Cache.Paint.DrawMultiColorString(e.Cache, e.Bounds, e.DisplayText, filterCellText, e.Appearance, Color.Black, Color.Gold, False, filterTextIndex)
e.Handled = True
End Sub
End Class
End Namespace