Guest User

Untitled

a guest
Nov 19th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. // Custom TaskItem Class.
  2. public class TaskItem
  3. {
  4.  
  5. // This adds a new TaskItem control.
  6. public void Add(TaskLabels task_label, bool show_separator, string task_subject, string task_title, string task_subtitle)
  7. {
  8.  
  9. // Set the texts for the three Task values.
  10. subject.Text = task_subject;
  11. title.Text = task_title;
  12. subtitle.Text = task_subtitle;
  13.  
  14. // If the TaskLabel option is set as "Important", then set the appropriate visual cues.
  15. // Likewise, if the TaskLabel option is set as "Finished", then set the appropriate visual cue.
  16. if (task_label == TaskLabels.Important) {
  17.  
  18. indicator.Visible = true;
  19.  
  20. subject.ForeColor = Color.FromArgb(243, 49, 85);
  21. indicator.LineColor = Color.FromArgb(243, 49, 85);
  22.  
  23. } else if (task_label == TaskLabels.Finished) {
  24. title.Font = new Font(subject.Font.FontFamily, 9.75, FontStyle.Strikeout);
  25. }
  26.  
  27. // If the user has disabled viewing an item's separator, which is hereby optional, then hide it.
  28. if (show_separator == false) {
  29. separator.Visible = false;
  30. }
  31.  
  32. }
  33.  
  34. // This provides a list of TaskLabel options.
  35. public enum TaskLabels
  36. {
  37.  
  38. General = 0,
  39. Intermediate = 1,
  40. Important = 2,
  41. Finished = 3
  42.  
  43. }
  44.  
  45. // On TaskItem MouseHover, some visual effects will be previewed.
  46. private void TaskItem_MouseHover(object sender, EventArgs e)
  47. {
  48. this.BackColor = Color.FromArgb(223, 218, 251);
  49. edit.Show();
  50. delete.Show();
  51. }
  52.  
  53. // On TaskItem MouseLeave, some visual effects will be previewed.
  54. private void TaskItem_MouseLeave(object sender, EventArgs e)
  55. {
  56. this.BackColor = Color.White;
  57. edit.Hide();
  58. delete.Hide();
  59. }
  60.  
  61. // TaskItem event builders.
  62. public TaskItem()
  63. {
  64. MouseLeave += TaskItem_MouseLeave;
  65. MouseHover += TaskItem_MouseHover;
  66. }
  67.  
  68. }
Add Comment
Please, Sign In to add comment