我的应用程序加载时如何显示图像 [英] How can i show an image while my application is loading

查看:183
本文介绍了我的应用程序加载时如何显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有和应用程序窗体.net和我的form1需要很多时间出现,因为在它的事件 form1_Load 做了很多操作。

i have and application windows form .net and my form1 takes a lot of time to appear because in it's event form1_Load does a lot of operation.

我的目标是在操作完成时显示一个图像。

My goal is to show an image while the operation are being done.

private void form1_Load(object sender, EventArgs e)
{            
    methode1();
}

虽然我的methode1()正在工作,但我的表单不显示,我想当我的methode1()正在工作时,屏幕上显示一个图像,因为在methode1()正在工作时,屏幕上没有任何内容。

While my methode1() is working, my form doesnt show, i want to show an image on the screen while my methode1() is working because while methode1() is working, there is nothing on the screen.

推荐答案

.net中的所有可视化内容都在表单上完成。您可以创建一个小的表单,其中包含一个图像在module1()之前加载,并在完成module1()之后关闭它。

All the visual things in .net is done on form. You can do it by creating an small form which contains an image load it before module1() and after completing module1() close it. Just below..

private void form1_Load(object sender, EventArgs e)
{    
        Form f = new Form();
        f.Size = new Size(400, 10);
        f.FormBorderStyle = FormBorderStyle.None;
        f.MinimizeBox = false;
        f.MaximizeBox = false;
        Image im = Image.FromFile(path);
        PictureBox pb = new PictureBox();
        pb.Dock = DockStyle.Fill;
        pb.Image = im;
        pb.Location = new Point(5, 5);
        f.Controls.Add(pb);
        f.Show();        
        methode1();
        f.Close();
}

这篇关于我的应用程序加载时如何显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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