form1.cs

来自「c#开发宝典 光盘内容。本光盘主要为书中的源程序」· CS 代码 · 共 32 行

CS
32
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Example19_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 frm = new Form2();
            DialogResult myDR = frm.ShowDialog();
            if (myDR == DialogResult.OK)
            {
                label1.Text = "欢迎您:"+frm.MyName;
            }
            else if (myDR == DialogResult.Cancel)
            {
                label1.Text = "未输入姓名";
            }
        }
    }
}

⌨️ 快捷键说明

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