protected virtual void OnDrawTicks(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); if ((this.OwnerDrawParts & TrackBarOwnerDrawParts.Ticks) == TrackBarOwnerDrawParts.Ticks && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ClientRectangle, (TrackBarItemState)this.ThumbState); if (this.DrawTicks != null) { this.DrawTicks((object)this, e); } } else { if (this.TickStyle == TickStyle.None || this.ThumbBounds.Equals((object)Rectangle.Empty)) { return; } Color color = Color.Black; if (VisualStyleRenderer.IsSupported) { color = new VisualStyleRenderer("TRACKBAR", 9, this.ThumbState).GetColor(ColorProperty.TextColor); } if (this.Orientation == Orientation.Horizontal) { this.DrawHorizontalTicks(graphics, color); } else { this.DrawVerticalTicks(graphics, color); } } graphics.Dispose(); }
/// <summary> /// Fires the DrawChannel events /// </summary> /// <param name="hdc">The device context for graphics operations</param> protected virtual void OnDrawChannel(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); if (((this.OwnerDrawParts & TrackBarOwnerDrawParts.Channel) == TrackBarOwnerDrawParts.Channel) && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ChannelBounds, (TrackBarItemState)this.ThumbState); if (this.DrawChannel != null) { this.DrawChannel(this, e); } } else { if (this.ChannelBounds.Equals(Rectangle.Empty)) { return; } if (VisualStyleRenderer.IsSupported) { VisualStyleRenderer vsr = new VisualStyleRenderer("TRACKBAR", (int)NativeMethods.TrackBarParts.TKP_TRACK, (int)TrackBarItemState.Normal); vsr.DrawBackground(graphics, this.ChannelBounds); graphics.ResetClip(); graphics.Dispose(); return; } ControlPaint.DrawBorder3D(graphics, this.ChannelBounds, Border3DStyle.Sunken); } graphics.Dispose(); }
/// <summary> /// Fires the DrawChannel events /// </summary> /// <param name="hdc">The device context for graphics operations</param> protected virtual void OnDrawChannel(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); if (((this.OwnerDrawParts & TrackBarOwnerDrawParts.Channel) == TrackBarOwnerDrawParts.Channel) && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ChannelBounds, (TrackBarItemState)this.ThumbState); if (this.DrawChannel != null) { this.DrawChannel(this, e); } } else { if (this.ChannelBounds.Equals(Rectangle.Empty)) { return; } if (VisualStyleRenderer.IsSupported) { VisualStyleRenderer vsr = new VisualStyleRenderer("TRACKBAR", (int)NativeMethods.TrackBarParts.TKP_TRACK, (int)TrackBarItemState.Normal); vsr.DrawBackground(graphics, this.ChannelBounds); graphics.ResetClip(); graphics.Dispose(); return; } ControlPaint.DrawBorder3D(graphics, this.ChannelBounds, Border3DStyle.Sunken); } graphics.Dispose(); }
protected virtual void OnDrawChannel(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); if ((this.OwnerDrawParts & TrackBarOwnerDrawParts.Channel) == TrackBarOwnerDrawParts.Channel && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ChannelBounds, (TrackBarItemState)this.ThumbState); if (this.DrawChannel != null) { this.DrawChannel((object)this, e); } } else { if (this.ChannelBounds.Equals((object)Rectangle.Empty)) { return; } if (VisualStyleRenderer.IsSupported) { new VisualStyleRenderer("TRACKBAR", 1, 1).DrawBackground((IDeviceContext)graphics, this.ChannelBounds); graphics.ResetClip(); graphics.Dispose(); return; } ControlPaint.DrawBorder3D(graphics, this.ChannelBounds, Border3DStyle.Sunken); } graphics.Dispose(); }
protected virtual void OnDrawChannel(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); if ((this.OwnerDrawParts & TrackBarOwnerDrawParts.Channel) == TrackBarOwnerDrawParts.Channel && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ChannelBounds, (TrackBarItemState)this.ThumbState); if (this.DrawChannel != null) this.DrawChannel((object)this, e); } else { if (this.ChannelBounds.Equals((object)Rectangle.Empty)) return; if (VisualStyleRenderer.IsSupported) { new VisualStyleRenderer("TRACKBAR", 1, 1).DrawBackground((IDeviceContext)graphics, this.ChannelBounds); graphics.ResetClip(); graphics.Dispose(); return; } ControlPaint.DrawBorder3D(graphics, this.ChannelBounds, Border3DStyle.Sunken); } graphics.Dispose(); }
/// <summary> /// Fires the DrawThumb events /// </summary> /// <param name="hdc">The device context for graphics operations</param> protected virtual void OnDrawThumb(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); graphics.Clip = new Region(this.ThumbBounds); if (((this.OwnerDrawParts & TrackBarOwnerDrawParts.Thumb) == TrackBarOwnerDrawParts.Thumb) && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ThumbBounds, (TrackBarItemState)this.ThumbState); if (this.DrawThumb != null) { this.DrawThumb(this, e); } } else { // Determine the style of the thumb, based on the tickstyle NativeMethods.TrackBarParts part = NativeMethods.TrackBarParts.TKP_THUMB; if (this.ThumbBounds.Equals(Rectangle.Empty)) { return; } switch (this.TickStyle) { case TickStyle.None: case TickStyle.BottomRight: part = (Orientation != Orientation.Horizontal) ? NativeMethods.TrackBarParts.TKP_THUMBRIGHT : NativeMethods.TrackBarParts.TKP_THUMBBOTTOM; break; case TickStyle.TopLeft: part = (this.Orientation != Orientation.Horizontal) ? NativeMethods.TrackBarParts.TKP_THUMBLEFT : NativeMethods.TrackBarParts.TKP_THUMBTOP; break; case TickStyle.Both: part = (this.Orientation != Orientation.Horizontal) ? NativeMethods.TrackBarParts.TKP_THUMBVERT : NativeMethods.TrackBarParts.TKP_THUMB; break; } // Perform drawing if (VisualStyleRenderer.IsSupported) { VisualStyleRenderer vsr = new VisualStyleRenderer("TRACKBAR", (int)part, ThumbState); vsr.DrawBackground(graphics, this.ThumbBounds); graphics.ResetClip(); graphics.Dispose(); return; } else { switch (part) { case NativeMethods.TrackBarParts.TKP_THUMBBOTTOM: this.DrawPointerDown(graphics); break; case NativeMethods.TrackBarParts.TKP_THUMBTOP: this.DrawPointerUp(graphics); break; case NativeMethods.TrackBarParts.TKP_THUMBLEFT: this.DrawPointerLeft(graphics); break; case NativeMethods.TrackBarParts.TKP_THUMBRIGHT: this.DrawPointerRight(graphics); break; default: if ((this.ThumbState == 3) || !this.Enabled) { ControlPaint.DrawButton(graphics, this.ThumbBounds, ButtonState.All); } else { // Tick-style is both - draw the thumb as a solid rectangle graphics.FillRectangle(SystemBrushes.Control, this.ThumbBounds); } ControlPaint.DrawBorder3D(graphics, this.ThumbBounds, Border3DStyle.Raised); break; } } } graphics.ResetClip(); graphics.Dispose(); }
protected virtual void OnDrawThumb(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); graphics.Clip = new Region(this.ThumbBounds); if ((this.OwnerDrawParts & TrackBarOwnerDrawParts.Thumb) == TrackBarOwnerDrawParts.Thumb && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ThumbBounds, (TrackBarItemState)this.ThumbState); if (this.DrawThumb != null) this.DrawThumb((object)this, e); } else { Fusionbird.FusionToolkit.NativeMethods.TrackBarParts trackBarParts = Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMB; if (this.ThumbBounds.Equals((object)Rectangle.Empty)) return; switch (this.TickStyle) { case TickStyle.None: case TickStyle.BottomRight: trackBarParts = this.Orientation != Orientation.Horizontal ? Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBRIGHT : Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBBOTTOM; break; case TickStyle.TopLeft: trackBarParts = this.Orientation != Orientation.Horizontal ? Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBLEFT : Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBTOP; break; case TickStyle.Both: trackBarParts = this.Orientation != Orientation.Horizontal ? Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBVERT : Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMB; break; } if (VisualStyleRenderer.IsSupported) { new VisualStyleRenderer("TRACKBAR", (int)trackBarParts, this.ThumbState).DrawBackground((IDeviceContext)graphics, this.ThumbBounds); graphics.ResetClip(); graphics.Dispose(); return; } switch (trackBarParts) { case Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBBOTTOM: this.DrawPointerDown(graphics); break; case Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBTOP: this.DrawPointerUp(graphics); break; case Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBLEFT: this.DrawPointerLeft(graphics); break; case Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBRIGHT: this.DrawPointerRight(graphics); break; default: if (this.ThumbState == 3 || !this.Enabled) ControlPaint.DrawButton(graphics, this.ThumbBounds, ButtonState.All); else graphics.FillRectangle(SystemBrushes.Control, this.ThumbBounds); ControlPaint.DrawBorder3D(graphics, this.ThumbBounds, Border3DStyle.Raised); break; } } graphics.ResetClip(); graphics.Dispose(); }
protected virtual void OnDrawTicks(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); if ((this.OwnerDrawParts & TrackBarOwnerDrawParts.Ticks) == TrackBarOwnerDrawParts.Ticks && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ClientRectangle, (TrackBarItemState)this.ThumbState); if (this.DrawTicks != null) this.DrawTicks((object)this, e); } else { if (this.TickStyle == TickStyle.None || this.ThumbBounds.Equals((object)Rectangle.Empty)) return; Color color = Color.Black; if (VisualStyleRenderer.IsSupported) color = new VisualStyleRenderer("TRACKBAR", 9, this.ThumbState).GetColor(ColorProperty.TextColor); if (this.Orientation == Orientation.Horizontal) this.DrawHorizontalTicks(graphics, color); else this.DrawVerticalTicks(graphics, color); } graphics.Dispose(); }
protected virtual void OnDrawThumb(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); graphics.Clip = new Region(this.ThumbBounds); if ((this.OwnerDrawParts & TrackBarOwnerDrawParts.Thumb) == TrackBarOwnerDrawParts.Thumb && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ThumbBounds, (TrackBarItemState)this.ThumbState); if (this.DrawThumb != null) { this.DrawThumb((object)this, e); } } else { Fusionbird.FusionToolkit.NativeMethods.TrackBarParts trackBarParts = Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMB; if (this.ThumbBounds.Equals((object)Rectangle.Empty)) { return; } switch (this.TickStyle) { case TickStyle.None: case TickStyle.BottomRight: trackBarParts = this.Orientation != Orientation.Horizontal ? Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBRIGHT : Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBBOTTOM; break; case TickStyle.TopLeft: trackBarParts = this.Orientation != Orientation.Horizontal ? Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBLEFT : Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBTOP; break; case TickStyle.Both: trackBarParts = this.Orientation != Orientation.Horizontal ? Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBVERT : Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMB; break; } if (VisualStyleRenderer.IsSupported) { new VisualStyleRenderer("TRACKBAR", (int)trackBarParts, this.ThumbState).DrawBackground((IDeviceContext)graphics, this.ThumbBounds); graphics.ResetClip(); graphics.Dispose(); return; } switch (trackBarParts) { case Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBBOTTOM: this.DrawPointerDown(graphics); break; case Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBTOP: this.DrawPointerUp(graphics); break; case Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBLEFT: this.DrawPointerLeft(graphics); break; case Fusionbird.FusionToolkit.NativeMethods.TrackBarParts.TKP_THUMBRIGHT: this.DrawPointerRight(graphics); break; default: if (this.ThumbState == 3 || !this.Enabled) { ControlPaint.DrawButton(graphics, this.ThumbBounds, ButtonState.All); } else { graphics.FillRectangle(SystemBrushes.Control, this.ThumbBounds); } ControlPaint.DrawBorder3D(graphics, this.ThumbBounds, Border3DStyle.Raised); break; } } graphics.ResetClip(); graphics.Dispose(); }
/// <summary> /// Fires the tick drawing events /// </summary> /// <param name="hdc">The device context that holds the graphics operations</param> protected virtual void OnDrawTicks(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); if (((this.OwnerDrawParts & TrackBarOwnerDrawParts.Ticks) == TrackBarOwnerDrawParts.Ticks) && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ClientRectangle, (TrackBarItemState)this.ThumbState); if (this.DrawTicks != null) { this.DrawTicks(this, e); } } else { if (this.TickStyle == TickStyle.None) { return; } if (this.ThumbBounds.Equals(Rectangle.Empty)) { return; } Color black = Color.Black; if (VisualStyleRenderer.IsSupported) { VisualStyleRenderer vsr = new VisualStyleRenderer("TRACKBAR", (int)NativeMethods.TrackBarParts.TKP_TICS, ThumbState); black = vsr.GetColor(ColorProperty.TextColor); } if (this.Orientation == Orientation.Horizontal) { this.DrawHorizontalTicks(graphics, black); } else { this.DrawVerticalTicks(graphics, black); } } graphics.Dispose(); }
/// <summary> /// Fires the DrawThumb events /// </summary> /// <param name="hdc">The device context for graphics operations</param> protected virtual void OnDrawThumb(IntPtr hdc) { Graphics graphics = Graphics.FromHdc(hdc); graphics.Clip = new Region(this.ThumbBounds); if (((this.OwnerDrawParts & TrackBarOwnerDrawParts.Thumb) == TrackBarOwnerDrawParts.Thumb) && !this.DesignMode) { TrackBarDrawItemEventArgs e = new TrackBarDrawItemEventArgs(graphics, this.ThumbBounds, (TrackBarItemState)this.ThumbState); if (this.DrawThumb != null) { this.DrawThumb(this, e); } } else { // Determine the style of the thumb, based on the tickstyle NativeMethods.TrackBarParts part = NativeMethods.TrackBarParts.TKP_THUMB; if (this.ThumbBounds.Equals(Rectangle.Empty)) { return; } switch (this.TickStyle) { case TickStyle.None: case TickStyle.BottomRight: part = (Orientation != Orientation.Horizontal) ? NativeMethods.TrackBarParts.TKP_THUMBRIGHT : NativeMethods.TrackBarParts.TKP_THUMBBOTTOM; break; case TickStyle.TopLeft: part = (this.Orientation != Orientation.Horizontal) ? NativeMethods.TrackBarParts.TKP_THUMBLEFT : NativeMethods.TrackBarParts.TKP_THUMBTOP; break; case TickStyle.Both: part = (this.Orientation != Orientation.Horizontal) ? NativeMethods.TrackBarParts.TKP_THUMBVERT : NativeMethods.TrackBarParts.TKP_THUMB; break; } // Perform drawing if (VisualStyleRenderer.IsSupported) { VisualStyleRenderer vsr = new VisualStyleRenderer("TRACKBAR", (int)part, ThumbState); vsr.DrawBackground(graphics, this.ThumbBounds); graphics.ResetClip(); graphics.Dispose(); return; } else { switch (part) { case NativeMethods.TrackBarParts.TKP_THUMBBOTTOM: this.DrawPointerDown(graphics); break; case NativeMethods.TrackBarParts.TKP_THUMBTOP: this.DrawPointerUp(graphics); break; case NativeMethods.TrackBarParts.TKP_THUMBLEFT: this.DrawPointerLeft(graphics); break; case NativeMethods.TrackBarParts.TKP_THUMBRIGHT: this.DrawPointerRight(graphics); break; default: if ((this.ThumbState == 3) || !this.Enabled) { ControlPaint.DrawButton(graphics, this.ThumbBounds, ButtonState.All); } else { // Tick-style is both - draw the thumb as a solid rectangle graphics.FillRectangle(SystemBrushes.Control, this.ThumbBounds); } ControlPaint.DrawBorder3D(graphics, this.ThumbBounds, Border3DStyle.Raised); break; } } } graphics.ResetClip(); graphics.Dispose(); }