This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainForm.cs
51 lines (45 loc) · 1.68 KB
/
MainForm.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
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraTreeList.Nodes;
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.ViewInfo;
namespace DXSample
{
public partial class MainForm : XtraForm
{
public MainForm()
{
InitializeComponent();
treeList.ExpandAll();
}
Rectangle hotTrackCheckBoxRectangle = Rectangle.Empty;
public Rectangle HotTrackCheckBoxRectangle {
get { return hotTrackCheckBoxRectangle; }
set {
if(hotTrackCheckBoxRectangle == value) return;
Rectangle prevHotTrackCheckBoxRectangle = hotTrackCheckBoxRectangle;
hotTrackCheckBoxRectangle = value;
treeList.Invalidate(prevHotTrackCheckBoxRectangle);
treeList.Invalidate(hotTrackCheckBoxRectangle);
}
}
private void OnCustomDrawNodeCheckBox(object sender, DevExpress.XtraTreeList.CustomDrawNodeCheckBoxEventArgs e) {
if(e.Bounds.Equals(HotTrackCheckBoxRectangle))
e.ObjectArgs.State = DevExpress.Utils.Drawing.ObjectState.Hot;
}
private void OnMouseMove(object sender, MouseEventArgs e) {
TreeList tree = sender as TreeList;
TreeListHitInfo info = tree.CalcHitInfo(e.Location);
if (info.HitInfoType == HitInfoType.NodeCheckBox)
HotTrackCheckBoxRectangle = info.Bounds;
else
HotTrackCheckBoxRectangle = Rectangle.Empty;
}
}
}