By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,572 Members | 2,949 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,572 IT Pros & Developers. It's quick & easy.

problem in picture displaying

P: 18
i display a pic on picture box and then i want to display another pic after some seconds
but problem is that first image is not displaying only display 2nd image

1... display first picture from database such as
pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture));

2... and then get the reference of current main thread
Thread main = Thread.CurrentThread;
Thread.Sleep(5000);

3.. and then display another pic
pbThumbImage.Image = global::TimeEntrySystem.Properties.Resources.Defau ltImage;

but problem is that first image is not displaying only display 2nd image
Aug 11 '08 #1
Share this Question
Share on Google+
4 Replies


yasirmturk
P: 13
Hey buddy

Try this

Expand|Select|Wrap|Line Numbers
  1. pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture));
  2. Application.DoEvents();
  3. Thread.Sleep(5000);
  4. pbThumbImage.Image = global::TimeEntrySystem.Properties.Resources.DefaultImage;
Hope that helps

i display a pic on picture box and then i want to display another pic after some seconds
but problem is that first image is not displaying only display 2nd image

1... display first picture from database such as
pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture));

2... and then get the reference of current main thread
Thread main = Thread.CurrentThread;
Thread.Sleep(5000);

3.. and then display another pic
pbThumbImage.Image = global::TimeEntrySystem.Properties.Resources.Defau ltImage;

but problem is that first image is not displaying only display 2nd image
Aug 11 '08 #2

P: 18
thanks to answer my question
buddy problem is solved

but there is an other problem when 1st pic is display , also a string is also display which blink through timer event but now this string not blink
Aug 11 '08 #3

yasirmturk
P: 13
Can you post the piece of code here

thanks to answer my question
buddy problem is solved

but there is an other problem when 1st pic is display , also a string is also display which blink through timer event but now this string not blink
Aug 11 '08 #4

tlhintoq
Expert 2.5K+
P: 3,525
I suspect the source of your problem is that you are putting the tread to sleep. When its asleep its not doing anything, including painting your dialog, updating your string etc. Its not a counter or wait function.

Many ways around it but here's one suggestion:
A timer with a 1000 interval (milliseconds therefore this is 1 second interval)
Set a counter to however many seconds you want to wait.
Decrement it and update your status string on each tick.
When your counter hits zero... Do something such as change the image.
Aug 12 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.