SharpDisplay: Migrating to new robust client scheme.
2 using System.Collections.Generic;
5 using System.Windows.Forms;
7 namespace Aga.Controls.Tree
9 internal class ReorderColumnState : ColumnState
13 private Point _location;
16 get { return _location; }
19 private Bitmap _ghostImage;
20 public Bitmap GhostImage
22 get { return _ghostImage; }
25 private TreeColumn _dropColumn;
26 public TreeColumn DropColumn
28 get { return _dropColumn; }
31 private int _dragOffset;
34 get { return _dragOffset; }
39 public ReorderColumnState(TreeViewAdv tree, TreeColumn column, Point initialMouseLocation)
42 _location = new Point(initialMouseLocation.X + Tree.OffsetX, 0);
43 _dragOffset = tree.GetColumnX(column) - initialMouseLocation.X;
44 _ghostImage = column.CreateGhostImage(new Rectangle(0, 0, column.Width, tree.ColumnHeaderHeight), tree.Font);
47 public override void KeyDown(KeyEventArgs args)
50 if (args.KeyCode == Keys.Escape)
54 public override void MouseDown(TreeNodeAdvMouseEventArgs args)
58 public override void MouseUp(TreeNodeAdvMouseEventArgs args)
63 public override bool MouseMove(MouseEventArgs args)
66 _location = new Point(args.X + Tree.OffsetX, 0);
68 foreach (TreeColumn c in Tree.Columns)
72 if (_location.X < x + c.Width / 2)
84 private void FinishResize()
87 if (Column == DropColumn)
91 Tree.Columns.Remove(Column);
92 if (DropColumn == null)
93 Tree.Columns.Add(Column);
95 Tree.Columns.Insert(Tree.Columns.IndexOf(DropColumn), Column);
97 Tree.OnColumnReordered(Column);