Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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
Sergey Alexandrovich Kryukov at 27-Dec-12 1:02am
   
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 at 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 at 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
0 OriginalGriff 7,205
1 DamithSL 5,114
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,747
4 Kornfeld Eliyahu Peter 4,474


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2014
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