// Programmer: Janet Joy // Select a month on scrollbar, display the season using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace seasons { public partial class Form1 : Form { public Form1() { InitializeComponent(); // We use a function so that we can execute same code at form load and when month changes. showMonth(); } private void hsbMonth_Scroll(object sender, ScrollEventArgs e) { showMonth(); } private void showMonth() { // Display the month. int month = hsbMonth.Value; lblMonth.Text = month.ToString(); // Display the season and change the color. switch(month) { case 12: case 1: case 2: lblSeason.Text = "Winter"; BackColor = Color.White; break; case 3: case 4: case 5: lblSeason.Text = "Spring"; BackColor = Color.Pink; break; case 6: case 7: case 8: lblSeason.Text = "Summer"; BackColor = Color.Green; break; case 9: case 10: case 11: lblSeason.Text = "Fall"; BackColor = Color.Gold; break; } } } }