Skip to content

Add TrackBar control with renderer and demo panel#119

Merged
jpobst merged 4 commits into
modern-forms:mainfrom
ProGraMajster:feature/controls/trackbar
Apr 6, 2026
Merged

Add TrackBar control with renderer and demo panel#119
jpobst merged 4 commits into
modern-forms:mainfrom
ProGraMajster:feature/controls/trackbar

Conversation

@ProGraMajster
Copy link
Copy Markdown
Contributor

Added TrackBar control with renderer and demo panel.

Supports mouse, keyboard and wheel input.
Includes tick marks and vertical orientation.

image

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new TrackBar (slider) control to Modern.Forms, including rendering/layout logic and a ControlGallery demo panel to showcase usage (orientation, ticks, snapping, input methods).

Changes:

  • Introduces TrackBar control with keyboard/mouse/wheel interaction, snapping, and tick configuration.
  • Adds TrackBarRenderer and registers it in RenderManager.
  • Adds TickStyle enum and a ControlGallery TrackBarPanel, plus a navigation entry in the gallery MainForm.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/Modern.Forms/TrackBar.cs New TrackBar control implementation (range/value, input handling, snapping).
src/Modern.Forms/TickStyle.cs New enum for tick-mark placement options used by TrackBar/renderer.
src/Modern.Forms/Renderers/TrackBarRenderer.cs New renderer for drawing the track/thumb/ticks and doing value↔position mapping.
src/Modern.Forms/Renderers/RenderManager.cs Registers the TrackBar renderer so the control can paint.
samples/ControlGallery/Panels/TrackBarPanel.cs Adds a demo panel showing multiple TrackBar configurations and interactive options.
samples/ControlGallery/MainForm.cs Adds TrackBar to the gallery tree and panel switch logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Modern.Forms/TrackBar.cs
Comment thread src/Modern.Forms/TrackBar.cs
Comment thread src/Modern.Forms/Renderers/TrackBarRenderer.cs
Comment thread src/Modern.Forms/Renderers/TrackBarRenderer.cs
Comment thread samples/ControlGallery/MainForm.cs Outdated
Comment thread src/Modern.Forms/TrackBar.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jpobst
Copy link
Copy Markdown
Collaborator

jpobst commented Apr 4, 2026

The only issue I found is: the mouse wheel and PageUp/PageDown do not work reliably when using SnapToTicks = true.

I think if the trackbar is using SnapToTicks and the user uses the mouse wheel or keyboard we should move to the next tick, even if that's not what SmallChange would imply.

@jpobst jpobst merged commit fe5f444 into modern-forms:main Apr 6, 2026
3 checks passed
@jpobst
Copy link
Copy Markdown
Collaborator

jpobst commented Apr 6, 2026

Great work! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants