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 demo6 {public partial class Form1: Form {public Form1 () {InitializeComponent ();} delegate string StartWorkDelegate (); // define the delegate StartWorkDelegate delegate void OffWorkDelegate (string s ); // Define the delegate OffWorkDelegate private void button1_Click (object sender, EventArgs e) // click the action executed by the go to work button {StartOffWork sw = new StartOffWork (); // instantiate the StartOffWork class/* instantiate the delegate StartWorkDelegate */StartWorkDelegate SWork = new StartWorkDelegate (sw. startWork); // StartWorkDelegate SWork = sw. startWork; // you can also use this statement to instantiate label2.Text = SWork (); // call the delegate and the result is displayed on the form} private void button2_Click (object sender, EventArgs e ){/* Instantiate the delegate OffWorkDelegate * // OffWorkDelegate OWork = new OffWorkDelegate (StartOffWork. offWork); OffWorkDelegate OWork = StartOffWork. offWork; // associate with the static method OWork (""); // call the delegate, the parameter is the end time} private void timer1_Tick_1 (object sender, EventArgs e) // Tick Event code of timer1 {label1.Text = "current time:" + DateTime. now. toString () ;}} public class StartOffWork // defines the management class StartOffWork {public string StartWork () // instance method {if (D AteTime. Now <= Convert. ToDateTime ("20:30") // you can determine if you have already gone to work {return "very early! ";}// The returned string is" very early !" Else {return "You are late. You can come early next time! ";}} Public static void OffWork (string offworktime) // static method {if (DateTime. now> Convert. toDateTime (offworktime) // determines whether the end time is {MessageBox. show ("hard work! ") ;}// The pop-up message box else {MessageBox. Show (" it's not time to get off work! ");}}}}