Proposal: add SelectionStart and SelectionEnd to TrackBar
See original GitHub issueYou can set the TBS_ENABLESELRANGE on TrackBar and send the TBM_SETSELSTART and TBM_SETSELSTART to set the selection range
See docs
- https://docs.microsoft.com/en-us/windows/win32/controls/tbm-setselstart
- https://docs.microsoft.com/en-us/windows/win32/controls/tbm-setselend
Example:

We could add the following APIs to TrackBar:
public class TrackBar
{
...
public bool ShowSelectionRange { get; set; }
public int SelectionStart { get; set; }
public int SelectionEnd { get; set; }
...
}
Discussion
- What should the default values of
SelectionStartandSelectionEndbe if we haven’t enabled selections? In my experiments I set them to0which worked nicely. - In my prototype implementation, I set
ShowSelectionRangetotrueif the user setsSelectionStart/SelectionEnd. One option could be to removeShowSelectionRangeand setSelectionStart/SelectionEndto minus one or have some logic that sets theTrackBarstyle toTBS_ENABLESELRANGEif it is set to a custom value. However, this is negative as it leaves us with no way of removing the selection indicators once they’ve been created. - Do we want
SelectionStartandSelectionEndorSelectionStartandSelectionLengthor some sort ofSelectionRangestruct that encapsulates this? (e.gMonthCalendar.SelectionRange)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:10 (10 by maintainers)
Top Results From Across the Web
How to bind the SelectionStart, SelectionEnd, Value when ...
I've a TrackBarEdit whose style I can change from TrackBarStyleSettings to TrackBarRangeStyleSettings and vice versa.
Read more >selectionStart/selectionEnd on input type="number" no ...
Use window.getSelection() to retrieve the selection object from the current input and then test extend the selection backwards (or forwards) and ...
Read more >NET Design Review: WinForms Review
... Approved: Discussion/proposal: add more LVCOLUMN ComCtl 6.0 features ... Approved: add SelectionStart and SelectionEnd to TrackBar ...
Read more >EBE Editor - GameGuru Forum
Hi Guys, I created this tool for a game and now the tool is finished and I forgot what I want to create....
Read more >HTMLInputElement: setSelectionRange() method - Web APIs
The HTMLInputElement.setSelectionRange() method sets the start and end positions of the current text selection in an or element.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@conorgee This is another trackbar improvement if you want to give it a go?
Few questions:
SelectionLength < 0SelectionStartto eitherMinimumorMaximumif outside the boundariesSelectionStart + SelectionLength > MaximumtoMaximum