社区
C#
帖子详情
谁有空讲一下private void button1_Click(object sender, System.EventArgs e) 里的sender和e是干什么用的,msdn上讲解,我没看懂
duancj_1981
2006-01-19 05:49:43
谁有空讲一下private void button1_Click(object sender, System.EventArgs e){} 里的sender和e是干什么用的,msdn上的讲解不太好懂.
最好通俗一点.
...全文
384
3
打赏
收藏
谁有空讲一下private void button1_Click(object sender, System.EventArgs e) 里的sender和e是干什么用的,msdn上讲解,我没看懂
谁有空讲一下private void button1_Click(object sender, System.EventArgs e){} 里的sender和e是干什么用的,msdn上的讲解不太好懂. 最好通俗一点.
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
xvting
2006-01-19
打赏
举报
回复
SENDER
button的click继承自control
control的click代码
protected virtual void OnClick(EventArgs e)
{
if (this.CanRaiseEvents)
{
EventHandler handler1 = (EventHandler) base.Events[Control.EventClick];
if (handler1 != null)
{
handler1(this, e);
}
}
}
handler1(this, e);
这里传递给sender的是this,所以这里的sender是这个button自己
jackeyooo
2006-01-19
打赏
举报
回复
sender 就是发出这个事件的对象阿,e代表一些参数,比如鼠标的枚举值等
xvting
2006-01-19
打赏
举报
回复
sender 就是这个button1
e:存放一些传递参数 EventArgs 顾名思义就是关于这个事件的一些参数
System.EventArgs 里的参数比较贫乏
看
private void button1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
e里面包含了,是哪个鼠标DOWN了,鼠标点的X,Y坐标等内容
C#计算器,C#小程序,关于编程的
简单的C#计算器,但很实用 using System; using System.Collections.Gen
er
ic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace calculator { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private
void
Btn_Clear_
Click
(
object
send
er
,
Event
Args
e) { txt_Result.Text =" "; }
private
void
button
0_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn=(
Button
)
send
er
; txt_Result .Text +=btn.Text ; }
private
void
Form1_Load(
object
send
er
,
Event
Args
e) { }
private
void
button
1_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text += btn.Text; }
private
void
button
2_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn=(
Button
)
send
er
; txt_Result .Text +=btn.Text ; }
private
void
button
3_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text += btn.Text; }
private
void
button
4_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text += btn.Text; }
private
void
button
5_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text += btn.Text; }
private
void
button
6_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text += btn.Text; }
private
void
button
7_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text += btn.Text; }
private
void
button
8_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text += btn.Text; }
private
void
button
9_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text += btn.Text; }
private
void
btn_Add_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text = txt_Result.Text + " " + btn.Text + " "; }
private
void
btn_Result_
Click
(
object
send
er
,
Event
Args
e) { double d_result; string s_txt = txt_Result.Text; int space = s_txt.IndexOf(' '); string s1 = s_txt.Substring(0, space); char op
er
ation =System. Conv
er
t.ToChar(s_txt.Substring((space + 1), 1)); string s2 = s_txt.Substring(space + 3); double arg1 =System . Conv
er
t.ToDouble(s1); double arg2 =System . Conv
er
t.ToDouble(s2); switch (op
er
ation) { case '+': d_result = arg1 + arg2; break; case '-': d_result = arg1 - arg2; break; case '*': d_result = arg1 * arg2; break; case '/': if (arg2 == 0) { throw new ApplicationException(); } else { d_result = arg1 / arg2; } break; default: throw new ApplicationException(); } txt_Result.Text = d_result.ToString(); }
private
void
btn_Sub_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text = txt_Result.Text+ " "+ btn.Text+ " "; }
private
void
btn_cheng_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text = txt_Result.Text + " " + btn.Text+ " "; }
private
void
btn_chu_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text = txt_Result.Text+ " "+ btn.Text + " "; }
private
void
button
10_
Click
(
object
send
er
,
Event
Args
e) {
Button
btn = (
Button
)
send
er
; txt_Result.Text = txt_Result.Text + " " + btn.Text + " "; }
private
void
button
10_
Click
_1(
object
send
er
,
Event
Args
e) { } } }
c# 实现p2p通信,c#p2p局域网聊天小软件源码
c#实现p2p局域网聊天小软件的源码,
private
void
button
1_
Click
(
object
send
er
, System.
Event
Args
e) {
button
1.Enabled = false;
button
2.Enabled = true; th = new Thread(new ThreadStart(Listen)); th.Start(); }
private
void
button
2_
Click
(
object
send
er
, System.
Event
Args
e) {
button
1.Enabled = true;
button
2.Enabled = false; listen
er
Run = false; Stop(); }
private
void
button
3_
Click
(
object
send
er
, System.
Event
Args
e) {
Send
(); }
简单界面应用
using System; using System.Collections.Gen
er
ic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication2 { public partial class Form1 : Form { Form2 f2; Form3 f3; Form4 f4; public Form1() { InitializeComponent(); }
private
void
lineShape1_
Click
(
object
send
er
,
Event
Args
e) { }
private
void
Form1_Load(
object
send
er
,
Event
Args
e) { }
private
void
label1_
Click
(
object
send
er
,
Event
Args
e) { }
private
void
button
1_
Click
(
object
send
er
,
Event
Args
e) { f2 = new Form2(); f2.Show(); this.Hide(); }
private
void
button
2_
Click
(
object
send
er
,
Event
Args
e) { f3 = new Form3(); f3.Show(); this.Hide(); }
private
void
button
3_
Click
(
object
send
er
,
Event
Args
e) { f4 = new Form4(); f4.Show(); this.Hide(); } } }
C# 短信猫开发案例支持(单口多口短信猫)
private
void
Sms_Receive_
Button
_
Click
(
object
send
er
, System.
Event
Args
e) { String ReceiveSmsStr=""; if (Sms_Receive("4", out ReceiveSmsStr) == 1) { ReceiveSms_Text.Text = ReceiveSmsStr; } else { ReceiveSms_Text.Text = "读取短信失败"; } }
private
void
Sms_Delete_
Button
_
Click
(
object
send
er
, System.
Event
Args
e) { Sms_Delete (DeleteSms_Index.Text); }
private
void
tim
er
1_Tick(
object
send
er
, System.
Event
Args
e) { if (Sms_NewFlag() == 1) { NewSms_Show.Text = "收到新短信,请查收!"; } }
private
void
Sms_Exit_
Button
_
Click
(
object
send
er
, System.
Event
Args
e) { Application.Exit(); }
学生资源信息管理系统
基本的学生信息管理系统 using System; using System.Collections.Gen
er
ic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace 学生管理系统 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private
void
Form1_Load(
object
send
er
,
Event
Args
e) { }
private
void
button
1_
Click
(
object
send
er
,
Event
Args
e) { Form2 f = new Form2(); f.Show(); }
private
void
btnClo_
Click
(
object
send
er
,
Event
Args
e) { this.Close(); }
private
void
button
2_
Click
(
object
send
er
,
Event
Args
e) { Form3 h = new Form3(); h.Show(); } } }
C#
110,572
社区成员
642,565
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章