moel@345: using System; moel@345: using System.Collections.Generic; moel@345: using System.Text; moel@345: using System.Windows.Forms; moel@345: using System.Security.Permissions; moel@345: using System.Drawing; moel@345: moel@345: namespace Aga.Controls.Tree moel@345: { moel@345: internal class ResizeColumnState: ColumnState moel@345: { moel@345: private Point _initLocation; moel@345: private int _initWidth; moel@345: moel@345: public ResizeColumnState(TreeViewAdv tree, TreeColumn column, Point p) moel@345: : base(tree, column) moel@345: { moel@345: _initLocation = p; moel@345: _initWidth = column.Width; moel@345: } moel@345: moel@345: public override void KeyDown(KeyEventArgs args) moel@345: { moel@345: args.Handled = true; moel@345: if (args.KeyCode == Keys.Escape) moel@345: FinishResize(); moel@345: } moel@345: moel@345: public override void MouseDown(TreeNodeAdvMouseEventArgs args) moel@345: { moel@345: } moel@345: moel@345: public override void MouseUp(TreeNodeAdvMouseEventArgs args) moel@345: { moel@345: FinishResize(); moel@345: } moel@345: moel@345: private void FinishResize() moel@345: { moel@345: Tree.ChangeInput(); moel@345: Tree.FullUpdate(); moel@345: Tree.OnColumnWidthChanged(Column); moel@345: } moel@345: moel@345: public override bool MouseMove(MouseEventArgs args) moel@345: { moel@345: Column.Width = _initWidth + args.Location.X - _initLocation.X; moel@345: Tree.UpdateView(); moel@345: return true; moel@345: } moel@345: moel@345: public override void MouseDoubleClick(TreeNodeAdvMouseEventArgs args) moel@345: { moel@345: Tree.AutoSizeColumn(Column); moel@345: } moel@345: } moel@345: }