c#窗体单击事件怎么写

来源:百度知道 编辑:UC知道 时间:2024/05/28 14:58:35
我正开始学c#.
想写一个窗体程序,单击窗体的时候弹出消息框.要怎么写呢?
使用的工具是VS2005,新建项目,windows应用程序,c#开始的代码如下,我要在哪里写窗体的单击事件(这个程序有一个窗体,类似VB中的窗体程序):

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

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

private void Form1_Load(object sender, EventArgs e)
{

}
}
}
不是在load事件中写,而是要在窗体的单击事件中写!aideqiuqian7

我是要问单击事件怎么写.load事件里弹出消息框我已经知道了.
能不能直接告诉我,窗体的单击事件怎么写,不是load事件!谢谢
找不到click事件啊,所以才问.
form1.cs里左边WindowsApplication1.Form1,右边没有click的选项!!晕死了

我说的是属性中的事件(图标是闪电)
那是事件,肯定有那个。。。。
你在去找找。。。

明白了。。。
在窗体属性事件中找Click事件,双击
出现
private void Form1_Click(object sender, EventArgs e)
{

}
在里边添加代码就ok。。。

private void Form1_Click(object sender, EventArgs e)
{
MessageBox.Show("你单击了一下窗体");
}