System.Windows.Forms.ThemeWin32Classic.DrawTrackBar_Horizontal C# (CSharp) Method

DrawTrackBar_Horizontal() private method

private DrawTrackBar_Horizontal ( Graphics dc, Rectangle clip_rectangle, TrackBar tb, Rectangle &thumb_pos, Rectangle &thumb_area, Brush br_thumb, float ticks, int value_pos, bool mouse_value ) : void
dc System.Drawing.Graphics
clip_rectangle System.Drawing.Rectangle
tb TrackBar
thumb_pos System.Drawing.Rectangle
thumb_area System.Drawing.Rectangle
br_thumb System.Drawing.Brush
ticks float
value_pos int
mouse_value bool
return void
		private void DrawTrackBar_Horizontal (Graphics dc, Rectangle clip_rectangle, TrackBar tb,
			ref Rectangle thumb_pos, ref Rectangle thumb_area, Brush br_thumb,
			float ticks, int value_pos, bool mouse_value) {			
			Point toptick_startpoint = new Point ();
			Point bottomtick_startpoint = new Point ();
			Point channel_startpoint = new Point ();
			float pixel_len;
			float pixels_betweenticks;
			Rectangle area = tb.ClientRectangle;
			
			GetTrackBarDrawingInfo (tb , out pixels_betweenticks, out thumb_area, out thumb_pos, out channel_startpoint, out bottomtick_startpoint, out toptick_startpoint);

			#region Track
			TrackBarDrawHorizontalTrack (dc, thumb_area, channel_startpoint, clip_rectangle);
			#endregion

			#region Thumb
			switch (tb.TickStyle) {
			case TickStyle.BottomRight:
			case TickStyle.None:
				thumb_pos.Y = channel_startpoint.Y - 8;
				TrackBarDrawHorizontalThumbBottom (dc, thumb_pos, br_thumb, clip_rectangle, tb);
				break;
			case TickStyle.TopLeft:
				thumb_pos.Y = channel_startpoint.Y - 10;
				TrackBarDrawHorizontalThumbTop (dc, thumb_pos, br_thumb, clip_rectangle, tb);
				break;
			default:
				thumb_pos.Y = area.Y + 10;
				TrackBarDrawHorizontalThumb (dc, thumb_pos, br_thumb, clip_rectangle, tb);
				break;
			}
			#endregion

			pixel_len = thumb_area.Width - 11;
			pixels_betweenticks = pixel_len / ticks;

			thumb_area.Y = thumb_pos.Y;
			thumb_area.X = channel_startpoint.X;
			thumb_area.Height = thumb_pos.Height;
			#region Ticks
			if (pixels_betweenticks <= 0)
				return;
			if (tb.TickStyle == TickStyle.None)
				return;
			Region outside = new Region (area);
			outside.Exclude (thumb_area);

			if (outside.IsVisible (clip_rectangle)) {
				ITrackBarTickPainter tick_painter = TrackBarGetHorizontalTickPainter (dc);

				if ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight) {
					float y = area.Y + bottomtick_startpoint.Y;
					for (float inc = 0; inc < pixel_len + 1; inc += pixels_betweenticks) {					
						float x = area.X + bottomtick_startpoint.X + inc;
						tick_painter.Paint (
							x, y, 
							x, y + (inc == 0 || inc + pixels_betweenticks >= pixel_len + 1 ? 3 : 2));
					}
				}

				if ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft) {
					float y = area.Y + toptick_startpoint.Y;
					for (float inc = 0; inc < pixel_len + 1; inc += pixels_betweenticks) {					
						float x = area.X + toptick_startpoint.X + inc;
						tick_painter.Paint (
							x, y - (inc == 0 || (inc + pixels_betweenticks) >= pixel_len + 1 ? 3 : 2), 
							x, y);
					}			
				}
			}
			
			outside.Dispose ();
			#endregion
		}
ThemeWin32Classic