In order to give students a preliminary impression of the event, they specially designed a interesting program. The interface is relatively simple, that is, to ask a simple question. You need to click Yes or No to answer the question. But when you click the "Yes" button, the "Yes" button will run in full windows.
This interesting program is temporarily interspersed in the teaching process. The purpose of using this program is to give students a preliminary impression on how to handle the event in C #. They need to register and implement the event. In addition, through this interesting program, this helps students understand the use of the Random and Point classes.
All the code of this program is as follows. Note the red code. The rest of the code is automatically generated by the designer.
Using System;
Using System. Drawing;
Using System. Collections;
Using System. ComponentModel;
Using System. Windows. Forms;
Using System. Data;
Namespace LoveMe
{
/// <Summary>
/// Summary of Form1.
/// </Summary>
Public class Form1: System. Windows. Forms. Form
{
Private System. Windows. Forms. Label label1;
Private System. Windows. Forms. Button yesButton;
Private System. Windows. Forms. Button noButton;
/// <Summary>
/// Required designer variables.
/// </Summary>
Private System. ComponentModel. Container components = null;
Public Form1 ()
{
//
// Required for Windows Form Designer support
//
InitializeComponent ();
//
// TODO: add Any constructor code after InitializeComponent calls
//
}
/// <Summary>
/// Clear all resources in use.
/// </Summary>
Protected override void Dispose (bool disposing)
{
If (disposing)
{
If (components! = Null)
{
Components. Dispose ();