C#我怎样才能显示图像,而我的应用程序加载 [英] c# How can i show an image while my application is loading

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

问题描述

我已经和应用程序窗口形成.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中所有的视觉事情的形式完成。您可以通过创建一个小的形式,它包含一个图像模块1()之前,完成模块1()关闭后加载它做到这一点。正下方。

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();
}

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

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