求助啊!我是个初学者啊!

tosame 2006-11-11 09:36:51
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace FirstWindowsApplication
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox name;
private System.Windows.Forms.Button but1;
private System.Windows.Forms.Button but2;
private System.Windows.Forms.Label label1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();

//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.name = new System.Windows.Forms.TextBox();
this.but1 = new System.Windows.Forms.Button();
this.but2 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// name
//
this.name.Location = new System.Drawing.Point(80, 56);
this.name.Name = "name";
this.name.Size = new System.Drawing.Size(168, 21);
this.name.TabIndex = 0;
this.name.Text = "";
//
// but1
//
this.but1.Location = new System.Drawing.Point(24, 136);
this.but1.Name = "but1";
this.but1.TabIndex = 2;
this.but1.Text = "退出";
this.but1.Click += new System.EventHandler(this.but1_Click);
//
// but2
//
this.but2.Location = new System.Drawing.Point(144, 136);
this.but2.Name = "but2";
this.but2.TabIndex = 3;
this.but2.Text = "好了!";
this.but2.Click += new System.EventHandler(this.but2_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(0, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(104, 16);
this.label1.TabIndex = 4;
this.label1.Text = "请输入你的名字:";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(248, 213);
this.Controls.Add(this.label1);
this.Controls.Add(this.but2);
this.Controls.Add(this.but1);
this.Controls.Add(this.name);
this.Name = "Form1";
this.Text = "FirstWinApp";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void but2_Click(object sender, System.EventArgs e)
{
MessageBox.Show("欢迎你!"+name.Text);
name.Text="";
}

private void but1_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
}
}


谁能给我解释一下啊!谢了

...全文
605 39 打赏 收藏 转发到动态 举报
写回复
用AI写文章
39 条回复
切换为时间正序
请发表友善的回复…
发表回复
OrangeSeaCoast 2006-11-14
  • 打赏
  • 举报
回复
呵呵,你新建一个项目,拖两控件,然后双击到代码窗口,把树型目录的加号都变成减号,就合上面的一样了。呵呵。
weiyicom 2006-11-14
  • 打赏
  • 举报
回复
private void but2_Click(object sender, System.EventArgs e)
{
MessageBox.Show("欢迎你!"+name.Text);
name.Text="";
}

private void but1_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
是自己写的,其他的是自动生成的,看书了好
DFL3000 2006-11-14
  • 打赏
  • 举报
回复
想想自己都做什么操作了,就可以理解了,除非你是直接拿个例子,然后运行,然后就提问.
sean840610 2006-11-14
  • 打赏
  • 举报
回复
LZ,注意看下注释,MICROSOFT的注释写的很好的,哪里是什么都写的很清楚,程序入口点之前的内容都是系统自动生成的,之后就是需要自己写的地方了。
希望LZ好好学习,C#很有前途滴
tosame 2006-11-14
  • 打赏
  • 举报
回复
大家我错了!但我真的不懂才问啊!你们别打击我的自信心好不好啊!
liutietuo 2006-11-13
  • 打赏
  • 举报
回复
只能说同情你.谁都是从那里走过来的.理解你.希望从基础开始.直接整代码.会很打击你的兴趣的,一起加油!
yiming0755 2006-11-13
  • 打赏
  • 举报
回复
得了各位,明显就是玩我们的,这么热心指导LZ是不是正中下怀啊
ilovechao1314 2006-11-13
  • 打赏
  • 举报
回复
你找个基础的书好好看看吧
terriou786 2006-11-13
  • 打赏
  • 举报
回复
楼猪去看看书吧!!!
狂啃馍馍 2006-11-13
  • 打赏
  • 举报
回复
跟哥学,想开点,天下没有不散的宴席。想当初,8个同事住90平米的大房子,天天打扑克,玩六角。一起喝酒,一起去海边看美女。。。 可是现在呢,人去房空,只剩下孤单单的自己还留守在这座城市当中,每当夜晚来临的时候,就有一种孤独和空虚在围绕着自己。
liqingle 2006-11-13
  • 打赏
  • 举报
回复
up!!
一个欢迎界面嘛!不知道兄弟你上学的时候是学什么专业的..
"你好"按钮是提示:"欢迎你!XX"的消息..
"退出"按钮是退出程序的.
lovvver 2006-11-12
  • 打赏
  • 举报
回复
先自己多做几个,然后再看点别人的例子,边看边学边体会。
yu_galaxy 2006-11-12
  • 打赏
  • 举报
回复
强~~~~~~~~顶!
楼主要具备关键基本知识:
理解"代理"\"事件"\"事件订阅"...
tosame 2006-11-12
  • 打赏
  • 举报
回复
太感谢大家了!你没真是大好人啊
wilensky 2006-11-12
  • 打赏
  • 举报
回复
无聊哈..
lgyangell 2006-11-12
  • 打赏
  • 举报
回复
...
huoapeng 2006-11-12
  • 打赏
  • 举报
回复
一共就2行代码.呵呵,分明是拿我们开心的.

算了,睡觉去.
eric2006 2006-11-12
  • 打赏
  • 举报
回复
up,看书...........
windykuang 2006-11-12
  • 打赏
  • 举报
回复
初始化的一些东东啊
miyimei 2006-11-12
  • 打赏
  • 举报
回复
楼主是vs2003的代码吧
楼主可以看看vs2005的代码,2005里面自动生成的代码和自己手工写的代码是分两个文件存放的,这样便于理解和维护
加载更多回复(19)

110,526

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧