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)