External/Aga.Controls/Tree/Input/ResizeColumnState.cs
author StephaneLenclud
Thu, 18 Apr 2013 23:25:10 +0200
branchMiniDisplay
changeset 444 9b09e2ee0968
permissions -rw-r--r--
Front View plug-in does not init if no sensor added.
Fixing some format to make strings shorter.
Now trying to start SoundGraphAccess.exe process from same directory.
Packed mode now can display three sensors along with the current time.
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 using System.Windows.Forms;
     5 using System.Security.Permissions;
     6 using System.Drawing;
     7 
     8 namespace Aga.Controls.Tree
     9 {
    10 	internal class ResizeColumnState: ColumnState
    11 	{
    12 		private Point _initLocation;
    13 		private int _initWidth;
    14 
    15 		public ResizeColumnState(TreeViewAdv tree, TreeColumn column, Point p)
    16 			: base(tree, column)
    17 		{
    18 			_initLocation = p;
    19 			_initWidth = column.Width;
    20 		}
    21 
    22 		public override void KeyDown(KeyEventArgs args)
    23 		{
    24 			args.Handled = true;
    25 			if (args.KeyCode == Keys.Escape)
    26 				FinishResize();
    27 		}
    28 
    29 		public override void MouseDown(TreeNodeAdvMouseEventArgs args)
    30 		{
    31 		}
    32 
    33 		public override void MouseUp(TreeNodeAdvMouseEventArgs args)
    34 		{
    35 			FinishResize();
    36 		}
    37 
    38 		private void FinishResize()
    39 		{
    40 			Tree.ChangeInput();
    41 			Tree.FullUpdate();
    42 			Tree.OnColumnWidthChanged(Column);
    43 		}
    44 
    45         public override bool MouseMove(MouseEventArgs args)
    46         {
    47 			Column.Width = _initWidth + args.Location.X - _initLocation.X;
    48             Tree.UpdateView();
    49             return true;
    50         }
    51 
    52 		public override void MouseDoubleClick(TreeNodeAdvMouseEventArgs args)
    53 		{
    54 			Tree.AutoSizeColumn(Column);
    55 		}
    56 	}
    57 }