private void OnButtonPressEvent(object o, ButtonPressEventArgs args) { if (!CanResize) { return; } int x_root = (int)args.Event.XRoot; int y_root = (int)args.Event.YRoot; int x, y; TranslatePosition(args.Event.Window, args.Event.X, args.Event.Y, out x, out y); UpdateCursor(x, y, true); if (resizing && args.Event.Button == 1) { window.BeginResizeDrag(last_edge, 1, x_root, y_root, args.Event.Time); } else if ((resizing && args.Event.Button == 2) || (args.Event.Button == 1 && y <= TopMoveHeight)) { window.BeginMoveDrag((int)args.Event.Button, x_root, y_root, args.Event.Time); } }
static void HandleMouseMove(object sender, MouseEventArgs e) { if (!can_dragging) { return; } int x = 0, y = 0; window.GetPosition(out x, out y); System.Windows.Point p = e.GetPosition(sender as UIElement); window.BeginMoveDrag(1, (int)p.X + x, (int)p.Y + y, 0); can_dragging = false; }