为什么没有this.Hide()在Form1_Load事件中的工作? [英] why isn't this.Hide() working in Form1_load event?

查看:342
本文介绍了为什么没有this.Hide()在Form1_Load事件中的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我反倒之一,拥有经典的Windows窗体和一个按钮。我有此代码

I have actually one classic Windows form and one button. I have this code

    private void Form1_Load(object sender, EventArgs e)
    {
        this.Hide();
        this.Visible = false;
    }

    private void button1_Click(object sender, EventArgs e)
    {
        this.Hide();
    }



我想知道为什么没有形成隐藏它正在刚过加载但是当我点击该按钮的工作原理?有人能解释一下吗?

I would like to know why isn't form hidden just after it is being loaded but works when I click on that button? Can somebody explain it?

推荐答案

表单之前触发Load事件实际上是可见的。尝试使用表.Shown 事件。当窗体实际上是屏幕上的痛苦,这将激发。

The Load event fires before the form is actually visible. Try using the Form.Shown event. This will fire when the form is actually pained on-screen.

这篇关于为什么没有this.Hide()在Form1_Load事件中的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆