pharaon450 pharaon450 - 1 year ago 67
C# Question

How can i show an image while my application is loading

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

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)

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.

Answer Source

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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download