-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMain.cs
42 lines (37 loc) · 1.22 KB
/
Main.cs
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
using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.Utils.Paint;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;
namespace DXSample
{
public partial class Main : XtraForm
{
public Main()
{
InitializeComponent();
}
private void OnLoad(object sender, EventArgs e)
{
recordBindingSource.DataSource = DataHelper.GetData(10);
}
private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
{
GridView view = (GridView)sender;
if (!view.OptionsView.ShowAutoFilterRow || !view.IsDataRow(e.RowHandle))
return;
string filterCellText = view.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, e.Column);
if ( String.IsNullOrEmpty(filterCellText) )
return;
int filterTextIndex = e.DisplayText.IndexOf(filterCellText, StringComparison.CurrentCultureIgnoreCase);
if ( filterTextIndex == -1 )
return;
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;
}
}
}