⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pushme.cs

📁 学生注册管理系统
💻 CS
字号:
using System;
using System.Windows.Forms;
using System.Drawing;

public class PushMe : Form {

  Button pushMeButton;

  public PushMe() {

    // Create Button
    pushMeButton = new Button(); 
    pushMeButton.Text = "Push Me";
    pushMeButton.Height = 60;
    pushMeButton.Width = 80;
    pushMeButton.Top = 60;
    pushMeButton.Left = 60;

    // Assign an event handler to the Button
    pushMeButton.Click += new EventHandler(ButtonClicked);

    // Add the Button to the Form
    this.Controls.Add(pushMeButton);

    // Size the Form and make it visible
    this.Height = 200;
    this.Width = 200;
    this.StartPosition = FormStartPosition.CenterScreen;
    this.Visible = true;
  }

  // event handling method for the "Push Me" Button
  public void ButtonClicked(object source, EventArgs e) {
    if ( pushMeButton.Text == "Push Me" ) {
      pushMeButton.Text = "Ouch";
    }
    else {
      pushMeButton.Text = "Push Me";
    }
  }

  static void Main() {
    Application.Run(new PushMe());
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -