Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Custom TaskItem Class.
- public class TaskItem
- {
- // This adds a new TaskItem control.
- public void Add(TaskLabels task_label, bool show_separator, string task_subject, string task_title, string task_subtitle)
- {
- // Set the texts for the three Task values.
- subject.Text = task_subject;
- title.Text = task_title;
- subtitle.Text = task_subtitle;
- // If the TaskLabel option is set as "Important", then set the appropriate visual cues.
- // Likewise, if the TaskLabel option is set as "Finished", then set the appropriate visual cue.
- if (task_label == TaskLabels.Important) {
- indicator.Visible = true;
- subject.ForeColor = Color.FromArgb(243, 49, 85);
- indicator.LineColor = Color.FromArgb(243, 49, 85);
- } else if (task_label == TaskLabels.Finished) {
- title.Font = new Font(subject.Font.FontFamily, 9.75, FontStyle.Strikeout);
- }
- // If the user has disabled viewing an item's separator, which is hereby optional, then hide it.
- if (show_separator == false) {
- separator.Visible = false;
- }
- }
- // This provides a list of TaskLabel options.
- public enum TaskLabels
- {
- General = 0,
- Intermediate = 1,
- Important = 2,
- Finished = 3
- }
- // On TaskItem MouseHover, some visual effects will be previewed.
- private void TaskItem_MouseHover(object sender, EventArgs e)
- {
- this.BackColor = Color.FromArgb(223, 218, 251);
- edit.Show();
- delete.Show();
- }
- // On TaskItem MouseLeave, some visual effects will be previewed.
- private void TaskItem_MouseLeave(object sender, EventArgs e)
- {
- this.BackColor = Color.White;
- edit.Hide();
- delete.Hide();
- }
- // TaskItem event builders.
- public TaskItem()
- {
- MouseLeave += TaskItem_MouseLeave;
- MouseHover += TaskItem_MouseHover;
- }
- }
Add Comment
Please, Sign In to add comment