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 18: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 Sergey Alexandrovich Kryukov 459
1 OriginalGriff 441
2 sanket saxena 349
3 Tadit Dash 310
4 Abhinav S 235
0 Sergey Alexandrovich Kryukov 12,109
1 OriginalGriff 7,326
2 Peter Leow 5,013
3 Abhinav S 4,013
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web04 | 2.8.140421.2 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid