کد سی شارپ - مثالی از نحوه استفاده از رویداد OnApplicationIdle

// OnApplicationIdle event using System; using System.Threading; using System.Reflection; using System.Windows.Forms; public class HelloWorldForm : Form { public HelloWorldForm() { Text = "Hello, WindowsForms!"; } } public class ApplicationEventHandlerClass { public void OnIdle(object sender, EventArgs e) { Console.WriteLine("The application is idle."); } } public class MainClass { public static void Main() { HelloWorldForm FormObject = new HelloWorldForm(); ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass(); Application.Idle += new EventHandler(AppEvents.OnIdle); Application.Run(FormObject); } }
/ 0 نظر / 36 بازدید