winForm 程序开发界面参数传递

1.

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 WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void ButtonClickMethod(object sender, EventArgs e)
        {
            this.nextForm = new Form2(this);
            this.nextForm.Show();
        }

        private Form2 nextForm;

        private void checkBox1_Click(object sender, EventArgs e)
        {
            this.nextForm.Close();
        }
    }
}
2.
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 WindowsFormsApplication2
{
    public partial class Form2 : Form
    {
        public Form2(Form1 f)
        {
            this.prevForm = f;
            InitializeComponent();
        }

        private Form1 prevForm;

        private void button1_Click(object sender, EventArgs e)
        {
            
        }
    }
}

你可能感兴趣的:(C#)