void mouseListner_MouseDown(object sender, MouseEventArgs e) { lastMouseDownPoint = e.Location; lastMouseDownSize = sizeChangeCtrl.Size; //動作を決定 status = DAndDArea.None; if (getTop().Contains(e.Location)) { status |= DAndDArea.Top; } if (getLeft().Contains(e.Location)) { status |= DAndDArea.Left; } if (getBottom().Contains(e.Location)) { status |= DAndDArea.Bottom; } if (getRight().Contains(e.Location)) { status |= DAndDArea.Right; } if (status != DAndDArea.None) { mouseListner.Capture = true; } }
/// <param name="sizeChangeCtrl">マウス入力によってサイズが変更されるコントロール</param> /// <param name="sizeChangeArea">上下左右のサイズ変更が有効になる範囲を指定</param> /// <param name="sizeChangeAreaWidth">サイズ変更が有効になる範囲の幅を指定</param> public DAndDSizeChanger(FrameworkElement sizeChangeCtrl, DAndDArea sizeChangeArea, int sizeChangeAreaWidth) { this.sizeChangeCtrl = sizeChangeCtrl; this.sizeChangeAreaWidth = sizeChangeAreaWidth; this.sizeChangeArea = sizeChangeArea; defaultCursor = sizeChangeCtrl.Cursor; sizeChangeCtrl.MouseMove += new MouseEventHandler(sizeChangeCtrl_MouseMove); sizeChangeCtrl.MouseDown += new MouseButtonEventHandler(sizeChangeCtrl_MouseDown); sizeChangeCtrl.MouseUp += new MouseButtonEventHandler(sizeChangeCtrl_MouseUp); }
/// <param name="mouseListner">マウス入力を受け取るコントロール</param> /// <param name="sizeChangeCtrl">マウス入力によってサイズが変更されるコントロール</param> /// <param name="sizeChangeArea">上下左右のサイズ変更が有効になる範囲を指定</param> /// <param name="sizeChangeAreaWidth">サイズ変更が有効になる範囲の幅を指定</param> public DAndDSizeChanger(Control mouseListner, Control sizeChangeCtrl, DAndDArea sizeChangeArea, int sizeChangeAreaWidth) { this.mouseListner = mouseListner; this.sizeChangeCtrl = sizeChangeCtrl; this.sizeChangeAreaWidth = sizeChangeAreaWidth; this.sizeChangeArea = sizeChangeArea; defaultCursor = mouseListner.Cursor; mouseListner.MouseDown += new MouseEventHandler(mouseListner_MouseDown); mouseListner.MouseMove += new MouseEventHandler(mouseListner_MouseMove); mouseListner.MouseUp += new MouseEventHandler(mouseListner_MouseUp); }
/// <param name="mouseListner">マウス入力を受け取るコントロール</param> /// <param name="sizeChangeCtrl">マウス入力によってサイズが変更されるコントロール</param> /// <param name="sizeChangeArea">上下左右のサイズ変更が有効になる範囲を指定</param> /// <param name="sizeChangeAreaWidth">サイズ変更が有効になる範囲の幅を指定</param> public DnDSizeChanger(Control mouseListner, Control sizeChangeCtrl, DAndDArea sizeChangeArea, int sizeChangeAreaWidth) { this.mouseListner = mouseListner; this.sizeChangeCtrl = sizeChangeCtrl; this.sizeChangeAreaWidth = sizeChangeAreaWidth; this.sizeChangeArea = sizeChangeArea; defaultCursor = mouseListner.Cursor; mouseListner.MouseDown += new MouseEventHandler(mouseListner_MouseDown); mouseListner.MouseMove += new MouseEventHandler(mouseListner_MouseMove); mouseListner.MouseUp += new MouseEventHandler(mouseListner_MouseUp); }
void mouseListner_MouseUp(object sender, MouseEventArgs e) { mouseListner.Capture = false; status = DAndDArea.None; }
void sizeChangeCtrl_MouseDown(object sender, MouseEventArgs e) { lastMouseDownPoint = e.GetPosition(sizeChangeCtrl); lastMouseDownSize = new System.Windows.Size(sizeChangeCtrl.Width,sizeChangeCtrl.Height); sizeChangeCtrl.CaptureMouse(); //動作を決定 status = DAndDArea.None; if (getTop().Contains((int)e.GetPosition(sizeChangeCtrl).X, (int)e.GetPosition(sizeChangeCtrl).Y)) { status |= DAndDArea.Top; } if (getLeft().Contains((int)e.GetPosition(sizeChangeCtrl).X, (int)e.GetPosition(sizeChangeCtrl).Y)) { status |= DAndDArea.Left; } if (getBottom().Contains((int)e.GetPosition(sizeChangeCtrl).X, (int)e.GetPosition(sizeChangeCtrl).Y)) { status |= DAndDArea.Bottom; } if (getRight().Contains((int)e.GetPosition(sizeChangeCtrl).X, (int)e.GetPosition(sizeChangeCtrl).Y)) { status |= DAndDArea.Right; } }