protected override void OnDragOver(DragEventArgs pArgs) { base.OnDragOver(pArgs); AutoScrollTimer lNewTimer = null; Point lLocation = PointToClient(new Point(pArgs.X, pArgs.Y)); int lScrollBarWidth = VerticalScroll.Visible ? SystemInformation.VerticalScrollBarWidth : 0; int lScrollBarHeight = HorizontalScroll.Visible ? SystemInformation.HorizontalScrollBarHeight : 0; int lAutoScrollMargin = 20; if (lLocation.X < lAutoScrollMargin) { lNewTimer = new AutoScrollLeftTimer(lLocation, this); } else if (Width - lScrollBarWidth - lLocation.X < lAutoScrollMargin) { lNewTimer = new AutoScrollRightTimer(lLocation, this); } else if (lLocation.Y < lAutoScrollMargin) { lNewTimer = new AutoScrollUpTimer(lLocation, this); } else if (Height - lScrollBarHeight - lLocation.Y < lAutoScrollMargin) { lNewTimer = new AutoScrollDownTimer(lLocation, this); } AutoScrollTimer.AutoScrollRedir lRedir = AutoScrollTimer.AutoScrollRedir.eNone; if (lNewTimer != null) { lRedir = AutoScrollTimer.Redir(lNewTimer); } else { lRedir = AutoScrollTimer.Redir(lLocation); } if (lRedir.HasFlag(AutoScrollTimer.AutoScrollRedir.eStop)) { AutoScrollTimer.Stop(); AutoScrollTimer = DummyTimer.Dummy; } if (lRedir.HasFlag(AutoScrollTimer.AutoScrollRedir.eStartNew)) { lNewTimer.Start(); AutoScrollTimer = lNewTimer; } }
/// <summary> /// Used to drag image /// or getting position for autoscrolltimer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> internal static void MainImage_MouseMove(object sender, MouseEventArgs e) { if (IsAutoScrolling) { // Start automainWindow.Scroller and report position AutoScrollPos = e.GetPosition(GetMainWindow.Scroller); AutoScrollTimer.Start(); } if (Color_Picking.IsRunning) { if (GetColorPicker.Opacity == 1) { Color_Picking.StartRunning(); } return; } PanImage(sender, e); }