-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathForm1.cs
44 lines (40 loc) · 1.46 KB
/
Form1.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
43
44
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraTreeList;
using DevExpress.Utils.Drawing;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
private DataTable CreateTable()
{
DataTable tbl = new DataTable();
tbl.Columns.Add("Name", typeof(string));
tbl.Columns.Add("ID", typeof(int));
tbl.Columns.Add("Number", typeof(int));
tbl.Columns.Add("Date", typeof(DateTime));
tbl.Columns.Add("ParentID", typeof(int));
for (int i = 0; i < 10; i++)
for (int j = 0; j < 5; j++)
tbl.Rows.Add(new object[] { String.Format("Name{0}", 10*i+j), 10*i+j + 1, 3 - 10*i+j, DateTime.Now.AddDays(10*i+j), 10*i+j });
return tbl;
}
public Form1()
{
InitializeComponent();
treeList1.DataSource = CreateTable();
}
private void treeList1_CustomDrawNodeIndicator(object sender, DevExpress.XtraTreeList.CustomDrawNodeIndicatorEventArgs e)
{
TreeList tree = sender as DevExpress.XtraTreeList.TreeList;
IndicatorObjectInfoArgs args = e.ObjectArgs as IndicatorObjectInfoArgs;
args.DisplayText = (tree.GetVisibleIndexByNode(e.Node) + 1).ToString();
e.ImageIndex = -1;
}
}
}