C# Windows Form Howto

为项目组写了几个Howto的Case。

本文描述了一个用C#实现的简单的Windows Form。
功能是先出现一个登陆窗口,然后用户输入用户名密码,登陆窗口隐藏,加载主窗口。

LoginForm.cs
[code=’c#’]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormHowto
{
public partial class LoginForm : Form
{
public LoginForm()
{
InitializeComponent();
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = “”;
textBox2.Text = “”;
}

private void button1_Click(object sender, EventArgs e)
{
MainForm mainForm = new MainForm(textBox1.Text);
this.Hide();
mainForm.Show();
}
}
}
[/code]

下载:用Visual Studio 2008打开
http://download.nocoo.us/Download/Archive/CSharpHowto/WindowsForm.rar

发表评论