Пример #1
0
        protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseDown(e);

            // Start dragging ?
            if (e.Button == MouseButtons.Left)
            {
                this.Capture = true;
                if (rcView.Contains(e.X, e.Y))
                {
                    drag = new ViewDrag(this, e.X, e.Y);
                }
                else
                {
                    // Move the viewport to the click points
                    Rectangle movedView = rcView;
                    movedView.X = e.X - movedView.Width / 2;
                    movedView.Y = e.Y - movedView.Height / 2;
                    Viewport    = movedView;

                    // Start dragging
                    drag = new ViewDrag(this, e.X, e.Y);
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                this.Capture = false;
                if (drag != null)
                {
                    drag.Cancel();
                    drag = null;
                }
            }
        }
Пример #2
0
        protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseUp(e);

            // Complete dragging
            if (drag != null)
            {
                this.Capture = false;
                drag.Complete(e.X, e.Y);
                drag = null;
            }

            // Stop autoscrolling
            if (scrollTimer != null)
            {
                scrollTimer.Enabled = false;
                scrollTimer         = null;
            }
        }
Пример #3
0
		protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
		{
			base.OnMouseUp(e);

			// Complete dragging
			if (drag != null)
			{
				this.Capture = false;
				drag.Complete(e.X,	e.Y);
				drag = null;
			}

			// Stop autoscrolling
			if (scrollTimer != null)
			{
				scrollTimer.Enabled = false;
				scrollTimer = null;
			}
		}
Пример #4
0
		protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
		{
			base.OnMouseDown(e);

			// Start dragging ?
			if (e.Button == MouseButtons.Left)
			{
				this.Capture = true;
				if (rcView.Contains(e.X, e.Y))
				{
					drag = new ViewDrag(this, e.X, e.Y);
				}
				else
				{
					// Move the viewport to the click points
					Rectangle movedView = rcView;
					movedView.X = e.X - movedView.Width / 2;
					movedView.Y = e.Y - movedView.Height / 2;
					Viewport = movedView;

					// Start dragging
					drag = new ViewDrag(this, e.X, e.Y);
				}
			}
			else if (e.Button == MouseButtons.Right)
			{
				this.Capture = false;
				if (drag != null)
				{
					drag.Cancel();
					drag = null;
				}
			}
		}