两个窗体的隐藏和显示程序
程序如下:
第一个窗口
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace chap1Ex03
{
public partial class Form1 : Form
{
private class Form2 form2Example;
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{ } private void checkBox1_CheckedChanged(object sender, EventArgs e)
{ } private void button1_Click(object sender, EventArgs e)
{
form2Example = new Form2();
button1.Enabled = false;
button2.Enabled = true;
button3.Enabled = true;
} private void button2_Click(object sender, EventArgs e)
{
form2Example.Visible = true;
} private void button3_Click(object sender, EventArgs e)
{
form2Example.Visible = false;
}
} private void Form1_Load(object sender, EventArgs e)
{
//设置窗体的位置合和大小
Rectangle pos = new Rectangle(250,250,300,300);
this.Bounds = pos;
}
}
第二个窗口:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace chap1Ex03
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
} private void label1_Click(object sender, EventArgs e)
{ } private void dol_Load(object sender, EventArgs e)
{
Rectangle pos = new Rectangle(550, 250, 300, 300);
this.Bounds = pos;
}
}
}
出错:错误 2 类、结构或接口成员声明中的标记“;”无效 D:\vs\chap1Ex03\chap1Ex03\Form1.cs 15 43 chap1Ex03
错误 3 类、结构或接口方法必须有返回类型 D:\vs\chap1Ex03\chap1Ex03\Form1.cs 16 16 chap1Ex03
我想问下第一个窗口中的private class Form2 form2Example;这句是什么意思?出错是什么原因?
程序如下:
第一个窗口
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace chap1Ex03
{
public partial class Form1 : Form
{
private class Form2 form2Example;
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{ } private void checkBox1_CheckedChanged(object sender, EventArgs e)
{ } private void button1_Click(object sender, EventArgs e)
{
form2Example = new Form2();
button1.Enabled = false;
button2.Enabled = true;
button3.Enabled = true;
} private void button2_Click(object sender, EventArgs e)
{
form2Example.Visible = true;
} private void button3_Click(object sender, EventArgs e)
{
form2Example.Visible = false;
}
} private void Form1_Load(object sender, EventArgs e)
{
//设置窗体的位置合和大小
Rectangle pos = new Rectangle(250,250,300,300);
this.Bounds = pos;
}
}
第二个窗口:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace chap1Ex03
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
} private void label1_Click(object sender, EventArgs e)
{ } private void dol_Load(object sender, EventArgs e)
{
Rectangle pos = new Rectangle(550, 250, 300, 300);
this.Bounds = pos;
}
}
}
出错:错误 2 类、结构或接口成员声明中的标记“;”无效 D:\vs\chap1Ex03\chap1Ex03\Form1.cs 15 43 chap1Ex03
错误 3 类、结构或接口方法必须有返回类型 D:\vs\chap1Ex03\chap1Ex03\Form1.cs 16 16 chap1Ex03
我想问下第一个窗口中的private class Form2 form2Example;这句是什么意思?出错是什么原因?
解决方案 »
- 哪位大侠 能讲一下 字符串拼接的具体作用是啥?谢谢
- 向大家请教关于radioButton 或者 checkbox取值入库的语句
- 当用户名重复先提示,点击确定后返回如何实现?
- 编译ActivexDLL类型为何一定要选为Com Interop 注册? 这个生成项目的选项是什么意思呢??
- DataGrid 记录修改后如何上传到数据库中?!
- winFor窗体放大,如何保持图片不变?!
- 关于treeview的问题(webForm)?
- 关于打印用不了自定义纸张的问题,请高手帮忙
- 请问哪里有英文版的VS.NET 2003能下?
- 关于C#运算符重载的问题???
- 求助c# word excel 格式文件转tif
- sql语句????
-------------------------------------改为:
private Form2 form2Example;另外注意分号的全角半角。