-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm1.cs
More file actions
46 lines (45 loc) · 1.58 KB
/
Copy pathForm1.cs
File metadata and controls
46 lines (45 loc) · 1.58 KB
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
using DevExpress.Utils.Drawing;
using DevExpress.XtraGrid.Views.Grid;
using System;
using System.Data;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void InitData()
{
var dt = new DataTable();
dt.Columns.Add("BoolProperty", typeof(bool));
dt.Columns.Add("StringProperty", typeof(string));
dt.Columns.Add("CurrentDate", typeof(DateTime));
dt.Columns.Add("IntProperty", typeof(Int32));
for (int i = 0; i <= 1000; i++)
dt.Rows.Add(new object[] { 0, i, DateTime.Today, i });
gridControl1.DataSource = dt;
}
private void Form1_Load(object sender, EventArgs e)
{
InitData();
}
private void gridView1_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
{
GridView view = sender as GridView;
if (e.Column?.FieldName == view.FocusedColumn.FieldName)
e.Info.State = ObjectState.Hot;
}
private void gridView1_FocusedColumnChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventArgs e)
{
((GridView)sender).InvalidateColumnHeader(e.FocusedColumn);
((GridView)sender).InvalidateColumnHeader(e.PrevFocusedColumn);
}
private void gridView1_Layout(object sender, EventArgs e)
{
((GridView)sender).InvalidateColumnHeader(null);
}
}
}