Skip to content

Commit

Permalink
UI Controls fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiye committed Nov 16, 2024
1 parent 4a0bc99 commit 086750e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 5 additions & 9 deletions Aga.Controls/Tree/AutoRowHeightLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace Aga.Controls.Tree
public class AutoRowHeightLayout: IRowLayout
{
private DrawContext _measureContext;
private TreeViewAdv _treeView;
private List<Rectangle> _rowCache;
private readonly TreeViewAdv _treeView;
private readonly List<Rectangle> _rowCache;

public AutoRowHeightLayout(TreeViewAdv treeView, int rowHeight)
{
Expand All @@ -20,13 +20,7 @@ public AutoRowHeightLayout(TreeViewAdv treeView, int rowHeight)
_measureContext.Graphics = Graphics.FromImage(new Bitmap(1, 1));
}

private int _rowHeight;
public int PreferredRowHeight
{
get { return _rowHeight; }
set { _rowHeight = value; }
}

public int PreferredRowHeight { get; set; }

public int PageRowCount
{
Expand Down Expand Up @@ -117,6 +111,8 @@ private int GetRowHeight(int rowNo)
public int GetRowAt(Point point)
{
int py = point.Y - _treeView.ColumnHeaderHeight;
if (py < 0) // Header column
return -1;
int y = 0;
for (int i = _treeView.FirstVisibleRow; i < _treeView.RowCount; i++)
{
Expand Down
4 changes: 4 additions & 0 deletions Aga.Controls/Tree/TreeViewAdv.Draw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public void AutoSizeColumn(TreeColumn column)
if (nc.ParentColumn == column)
w += nc.GetActualSize(node, _measureContext).Width;
}
if (column.Index == 0)
{
w += node.Level * _indent + LeftMargin;
}
res = Math.Max(res, w);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Aga.Controls/Tree/TreeViewAdv.Input.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using Aga.Controls.Tree.NodeControls;
Expand Down Expand Up @@ -453,6 +451,8 @@ private void DragTimerTick(object state)
private void DragAutoScroll()
{
_dragAutoScrollFlag = false;
if (_vScrollBar.Minimum == _vScrollBar.Maximum)
return;
Point pt = PointToClient(MousePosition);
if (pt.Y < 20 && _vScrollBar.Value > 0)
_vScrollBar.Value--;
Expand Down

0 comments on commit 086750e

Please sign in to comment.