This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
MyGridViewInfo.cs
69 lines (64 loc) · 2.02 KB
/
MyGridViewInfo.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using DevExpress.XtraGrid.Drawing;
using DevExpress.Utils;
using DevExpress.Utils.Drawing;
using DevExpress.XtraEditors.Drawing;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using DevExpress.XtraGrid.Views.Grid;
using System.ComponentModel;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Base.ViewInfo;
namespace GridControlWithFindPanel
{
public class MyGridViewInfo : GridViewInfo
{
public MyGridViewInfo(GridView gridView)
: base(gridView)
{
}
GridHitInfo CalcColumnPanelHitInfo(Point pt, GridHitInfo hi)
{
GridColumnInfoArgs ci = CalcColumnHitInfo(pt);
bool bottomEdge;
bottomEdge = IntInRangeBottom(pt.Y, ci.Bounds.Bottom, ci.Bounds.Bottom - ControlUtils.ColumnResizeEdgeSize);
if (bottomEdge)
{
hi.HitTest = GridHitTest.RowEdge;
}
return hi;
}
protected bool IntInRangeBottom(int y, int top, int bottom)
{
if (bottom < top)
{
int temp = top;
top = bottom;
bottom = temp;
}
return (y >= top && y < bottom);
}
protected internal bool CheckHitTest(Rectangle bounds, Point point, GridHitTest hitTest)
{
if (GridDrawing.PtInRect(bounds, point))
{
return true;
}
return false;
}
public override GridHitInfo CalcHitInfo(Point pt, bool ignoreData = false)
{
GridHitInfo hi = base.CalcHitInfo(pt);
hi.HitPoint = pt;
if (!IsReady) return hi;
if (View.OptionsView.ShowColumnHeaders && CheckHitTest(ViewRects.ColumnPanel, pt, GridHitTest.ColumnPanel))
{
return CalcColumnPanelHitInfo(pt, hi);
}
return hi;
}
}
}