api-approveddesign-discussionhelp wantedtenet-compatibility-OS
倉庫指標
- Star
- (4,100 star)
- PR 合併指標
- (平均合併 14天 22小時) (30 天內合併 56 個 PR)
描述
You 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)