Click here to Skip to main content
12,241,599 members (39,093 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0
Hi,

I have 4 images .i want to display all the 4 images one by oneusing progress bar on button clik event in window application.

Give some idea.
Posted 26-Dec-12 19:59pm
Comments
   
What does it mean "using progress bar"? A progress bar does not help showing anything...
And you apparently suffer from "button sickness". "On button click..."
—SA

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

using System;
using System.Windows.Forms;
using System.Drawing;
using System.Threading;
 
class Program
{
class ImageForm : Form
{
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new ImageForm());
}
private ProgressBar pb;
public ImageForm()
{
Button button = new Button();
button.Text = "Load";
Controls.Add(button);
button.Click += new EventHandler(button_Click);
pb = new ProgressBar();
pb.Dock = DockStyle.Bottom;
pb.Style = ProgressBarStyle.Marquee;
pb.Visible = false;
Controls.Add(pb);
}
 
void button_Click(object sender, EventArgs e)
{
pb.Visible = true;
ThreadPool.QueueUserWorkItem(LoadImage);
}
private void LoadImage(object state)
{
Thread.Sleep(5000); // to make it look slower to demo
Image img = Image.FromFile(@"C:\WINDOWS\Coffee Bean.bmp");
Invoke((MethodInvoker) delegate {
BackgroundImage = img;
pb.Visible = false;
});
}
}
}
from here[^]
  Permalink  
Comments
gmmanasbbsr 27-Dec-12 1:24am
   
hi Sergey thanks for your response.but
i want 4 images should display one by one in picture box with progress bar.kindly give some sollution.
Krunal Rohit 27-Dec-12 1:26am
   
No, we won't give you solution.. We can't work out for you like this.. You should try it by yourself.. If you got stuck somewhere, you can certainly come here.. But don't ask directly for code..
-Krunal R.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100