Last active
June 19, 2020 07:31
-
-
Save grokys/6f9d508241cf7837f45c76c2a1eabf42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DateTimePickerColumn : Panel | |
{ | |
// The type of the column: numbers or months | |
public DateTimePickerColumnType Type { get; set; } | |
// The number or month at the top of the column | |
public int First { get; set; } | |
// The selected number or month | |
public int Selected { get; set; } | |
public int Minimum {get; set; } | |
public int Maximum {get; set; } | |
public void ScrollUp() | |
{ | |
--First; // Handle looping etc also | |
UpdateItems(); | |
} | |
public void ScrollDown() | |
{ | |
++First; // Handle looping etc also | |
UpdateItems(); | |
} | |
protected override void MeasureOverride(Size size) | |
{ | |
// ... Creates and measures enough ListBoxItems to fill size ... | |
UpdateItems(); | |
} | |
protected override ArrangeOverride(Size size) | |
{ | |
// Arranges the ListBoxItems in a vertical stack | |
} | |
private void UpdateItems() | |
{ | |
// Assigns a number or a month to each ListBoxItem, and sets IsSelected if | |
// it's the currently selected item | |
} | |
} | |
public enum DateTimePickerColumnType | |
{ | |
Numeric, | |
Months, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment