Skip to content

Commit 086750e

Browse files
committed
UI Controls fixes
1 parent 4a0bc99 commit 086750e

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

Aga.Controls/Tree/AutoRowHeightLayout.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ namespace Aga.Controls.Tree
88
public class AutoRowHeightLayout: IRowLayout
99
{
1010
private DrawContext _measureContext;
11-
private TreeViewAdv _treeView;
12-
private List<Rectangle> _rowCache;
11+
private readonly TreeViewAdv _treeView;
12+
private readonly List<Rectangle> _rowCache;
1313

1414
public AutoRowHeightLayout(TreeViewAdv treeView, int rowHeight)
1515
{
@@ -20,13 +20,7 @@ public AutoRowHeightLayout(TreeViewAdv treeView, int rowHeight)
2020
_measureContext.Graphics = Graphics.FromImage(new Bitmap(1, 1));
2121
}
2222

23-
private int _rowHeight;
24-
public int PreferredRowHeight
25-
{
26-
get { return _rowHeight; }
27-
set { _rowHeight = value; }
28-
}
29-
23+
public int PreferredRowHeight { get; set; }
3024

3125
public int PageRowCount
3226
{
@@ -117,6 +111,8 @@ private int GetRowHeight(int rowNo)
117111
public int GetRowAt(Point point)
118112
{
119113
int py = point.Y - _treeView.ColumnHeaderHeight;
114+
if (py < 0) // Header column
115+
return -1;
120116
int y = 0;
121117
for (int i = _treeView.FirstVisibleRow; i < _treeView.RowCount; i++)
122118
{

Aga.Controls/Tree/TreeViewAdv.Draw.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public void AutoSizeColumn(TreeColumn column)
2929
if (nc.ParentColumn == column)
3030
w += nc.GetActualSize(node, _measureContext).Width;
3131
}
32+
if (column.Index == 0)
33+
{
34+
w += node.Level * _indent + LeftMargin;
35+
}
3236
res = Math.Max(res, w);
3337
}
3438
}

Aga.Controls/Tree/TreeViewAdv.Input.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42
using System.Windows.Forms;
53
using System.Drawing;
64
using Aga.Controls.Tree.NodeControls;
@@ -453,6 +451,8 @@ private void DragTimerTick(object state)
453451
private void DragAutoScroll()
454452
{
455453
_dragAutoScrollFlag = false;
454+
if (_vScrollBar.Minimum == _vScrollBar.Maximum)
455+
return;
456456
Point pt = PointToClient(MousePosition);
457457
if (pt.Y < 20 && _vScrollBar.Value > 0)
458458
_vScrollBar.Value--;

0 commit comments

Comments
 (0)