关于C#中创建多个窗口

来源:百度知道 编辑:UC知道 时间:2024/05/15 10:34:35
怎么在一个项目中创建多个窗口呢?就像我想写个程序,当点击一个按钮后就出现注册用户的另一个窗口,请高手赐教,先谢谢了

你得先就事先建立好一个已经可以注册的窗口,假设为frmLogin,然后在这个按钮的代理中加入下面的代码
frmLogin fl=new frmLogin();
fl.Show();

。。最简单的是
MessageBox.Show("您登陆成功");

先创建两个窗口一个为FORM1另一个为FORM2
再按钮的代码下写
FORM2 frm = new FORM2 ();
frm.Show();
就可了

他的窗口有两面种形式,
一种是模式
一种是非模式,
你可以先建一个
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

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

private void button1_Click(object sender, EventArgs e)
{
Form hu = new Form();//建一个新的口,
hu.Text = "hello";
hu.BackColor = Color.RoyalBlue;
Button hb = new Button();