private void DrawTrackBar_Vertical (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
TrackBarDrawVerticalTrack (dc, thumb_area, channel_startpoint, clip_rectangle);
#endregion
#region Thumb
switch (tb.TickStyle) {
case TickStyle.BottomRight:
case TickStyle.None:
thumb_pos.X = channel_startpoint.X - 8;
TrackBarDrawVerticalThumbRight (dc, thumb_pos, br_thumb, clip_rectangle, tb);
break;
case TickStyle.TopLeft:
thumb_pos.X = channel_startpoint.X - 10;
TrackBarDrawVerticalThumbLeft (dc, thumb_pos, br_thumb, clip_rectangle, tb);
break;
default:
thumb_pos.X = area.X + 10;
TrackBarDrawVerticalThumb (dc, thumb_pos, br_thumb, clip_rectangle, tb);
break;
}
#endregion
pixel_len = thumb_area.Height - 11;
pixels_betweenticks = pixel_len / ticks;
thumb_area.X = thumb_pos.X;
thumb_area.Y = channel_startpoint.Y;
thumb_area.Width = 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 = TrackBarGetVerticalTickPainter (dc);
if ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight) {
float x = area.X + bottomtick_startpoint.X;
for (float inc = 0; inc < pixel_len + 1; inc += pixels_betweenticks) {
float y = area.Y + bottomtick_startpoint.Y + inc;
tick_painter.Paint (
x, y,
x + (inc == 0 || inc + pixels_betweenticks >= pixel_len + 1 ? 3 : 2), y);
}
}
if ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft) {
float x = area.X + toptick_startpoint.X;
for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {
float y = area.Y + toptick_startpoint.Y + inc;
tick_painter.Paint (
x - (inc == 0 || inc + pixels_betweenticks >= pixel_len + 1 ? 3 : 2), y,
x, y);
}
}
}
outside.Dispose ();
#endregion
}