View | Details | Raw Unified | Return to bug 322421
Collapse All | Expand All

(-)System.Windows.Forms/TrackBar.cs (-17 / +33 lines)
Lines 63-68 Link Here
63
		private System.Timers.Timer holdclick_timer = new System.Timers.Timer ();
63
		private System.Timers.Timer holdclick_timer = new System.Timers.Timer ();
64
		internal int thumb_mouseclick;		
64
		internal int thumb_mouseclick;		
65
		private bool mouse_clickmove;
65
		private bool mouse_clickmove;
66
		private bool is_moving_right; // which way the thumb should move when mouse is down (right=up, left=down) 
66
67
67
		#region events
68
		#region events
68
		[Browsable (false)]
69
		[Browsable (false)]
Lines 515-521 Link Here
515
			bool fire_timer = false;
516
			bool fire_timer = false;
516
    			
517
    			
517
    			Point point = new Point (e.X, e.Y);
518
    			Point point = new Point (e.X, e.Y);
518
519
	
519
			if (orientation == Orientation.Horizontal) {
520
			if (orientation == Orientation.Horizontal) {
520
				
521
				
521
				if (thumb_pos.Contains (point)) {
522
				if (thumb_pos.Contains (point)) {
Lines 526-532 Link Here
526
				}
527
				}
527
				else {
528
				else {
528
					if (ClientRectangle.Contains (point)) {
529
					if (ClientRectangle.Contains (point)) {
529
						if (e.X > thumb_pos.X + thumb_pos.Width)
530
						is_moving_right = e.X > thumb_pos.X + thumb_pos.Width; 
531
						if (is_moving_right) 
530
							LargeIncrement ();
532
							LargeIncrement ();
531
						else
533
						else
532
							LargeDecrement ();
534
							LargeDecrement ();
Lines 547-553 Link Here
547
				}
549
				}
548
				else {
550
				else {
549
					if (ClientRectangle.Contains (point)) {
551
					if (ClientRectangle.Contains (point)) {
550
						if (e.Y > thumb_pos.Y + thumb_pos.Height)
552
						is_moving_right = e.Y > thumb_pos.Y + thumb_pos.Height;
553
						if (is_moving_right)
551
							LargeDecrement ();
554
							LargeDecrement ();
552
						else
555
						else
553
							LargeIncrement ();
556
							LargeIncrement ();
Lines 631-654 Link Here
631
			Point pnt;
634
			Point pnt;
632
			pnt = PointToClient (MousePosition);			
635
			pnt = PointToClient (MousePosition);			
633
636
637
			/*
638
				On Win32 the thumb only moves in one direction after a click, 
639
				if the thumb passes the clicked point it will never go in the 
640
				other way unless the mouse is released and clicked again. This
641
				is also true if the mouse moves while beeing hold down.
642
			*/
643
			
634
			if (thumb_area.Contains (pnt)) 	{
644
			if (thumb_area.Contains (pnt)) 	{
645
				bool invalidate = false;
635
				if (orientation == Orientation.Horizontal) {
646
				if (orientation == Orientation.Horizontal) {
636
					if (pnt.X > thumb_pos.X + thumb_pos.Width)
647
					if (pnt.X > thumb_pos.X + thumb_pos.Width && is_moving_right) {
637
						LargeIncrement ();
648
						LargeIncrement ();
638
649
						invalidate = true;
639
					if (pnt.X < thumb_pos.X)
650
                    } else if (pnt.X < thumb_pos.X && !is_moving_right) {
640
						LargeDecrement ();						
651
                    	LargeDecrement ();			
652
                    	invalidate = true;
653
					}
641
				}
654
				}
642
				else 				{
655
				else {
643
					if (pnt.Y > thumb_pos.Y + thumb_pos.Height)
656
					if (pnt.Y > thumb_pos.Y + thumb_pos.Width && is_moving_right) {
644
						LargeIncrement ();
657
 						LargeDecrement ();		
645
658
                    	invalidate = true;
646
					if (pnt.Y < thumb_pos.Y)
659
					} else if (pnt.Y < thumb_pos.Y && !is_moving_right) {
647
						LargeDecrement ();
660
						LargeIncrement ();		
648
				}
661
                    	invalidate = true;
649
662
                    }
650
				Invalidate (thumb_area);
663
 				}
651
664
 				if (invalidate)
665
 					// A Refresh is necessary because the mouse is down and if we just invalidate
666
 					// we'll only get paint events once in a while.
667
 					Refresh();
652
			}			
668
			}			
653
		}					
669
		}					
654
670

Return to bug 322421