请问winForm 的Activated是什么事件

csl_zm007 2009-07-18 09:05:43
请问winForm 的Activated是什么事件
...全文
1060 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Skyhoo 2009-07-18
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 csl_zm007 的回复:]
引用 1 楼 nick_fire 的回复:
当前活动

show的时候加载的吗?
[/Quote]
不明白你的意思。。比如 现在做个MDI窗体,里面好有多子窗体,但是你不能同时操作所有,你只能操作一个,那么 当你选择你要操作的窗体时你想有什么操作,Form1_Activated 事件下的内容就是你想对其操作的内容。。
paulin 2009-07-18
  • 打赏
  • 举报
回复
用户或者程序激活窗体时就发生
所以这个事件几乎随时都发生
f531797488 2009-07-18
  • 打赏
  • 举报
回复
窗体时时响应事件,每当鼠标点击窗体都会执行
Skyhoo 2009-07-18
  • 打赏
  • 举报
回复
你可以参考一下
Skyhoo 2009-07-18
  • 打赏
  • 举报
回复
static int x = 200;
static int y = 200;

private void Button1_Click(System.Object sender,
System.EventArgs e)
{
// Create a new Form1 and set its Visible property to true.
Form1 form2 = new Form1();
form2.Visible = true;

// Set the new form's desktop location so it
// appears below and to the right of the current form.
form2.SetDesktopLocation(x, y);
x += 30;
y += 30;

// Keep the current form active by calling the Activate
// method.
this.Activate();
this.Button1.Enabled = false;
}



// Updates the label text to reflect the current values of x
// and y, which was were incremented in the Button1 control's
// click event.
private void Form1_Activated(object sender, System.EventArgs e)
{
Label1.Text = "x: "+x+" y: "+y;
Label2.Text = "Number of forms currently open: "+count;
}

static int count = 0;

private void Form1_Closed(object sender, System.EventArgs e)
{
count -= 1;
}

private void Form1_Load(object sender, System.EventArgs e)
{
count += 1;
}
csl_zm007 2009-07-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 nick_fire 的回复:]
当前活动
[/Quote]
show的时候加载的吗?
Skyhoo 2009-07-18
  • 打赏
  • 举报
回复
当前活动

111,113

社区成员

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

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

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