problem in picture displaying

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shahidrasul
    New Member
    • Aug 2008
    • 18

    problem in picture displaying

    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.Im age = new Bitmap(new MemoryStream(ob jEmployee.Pictu re));

    2... and then get the reference of current main thread
    Thread main = Thread.CurrentT hread;
    Thread.Sleep(50 00);

    3.. and then display another pic
    pbThumbImage.Im age = global::TimeEnt rySystem.Proper ties.Resources. DefaultImage;

    but problem is that first image is not displaying only display 2nd image
  • yasirmturk
    New Member
    • Aug 2008
    • 15

    #2
    Hey buddy

    Try this

    Code:
    pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture));
    [B]Application.DoEvents();[/B]
    Thread.Sleep(5000);
    pbThumbImage.Image = global::TimeEntrySystem.Properties.Resources.DefaultImage;
    Hope that helps

    Originally posted by shahidrasul
    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.Im age = new Bitmap(new MemoryStream(ob jEmployee.Pictu re));

    2... and then get the reference of current main thread
    Thread main = Thread.CurrentT hread;
    Thread.Sleep(50 00);

    3.. and then display another pic
    pbThumbImage.Im age = global::TimeEnt rySystem.Proper ties.Resources. DefaultImage;

    but problem is that first image is not displaying only display 2nd image

    Comment

    • shahidrasul
      New Member
      • Aug 2008
      • 18

      #3
      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

      Comment

      • yasirmturk
        New Member
        • Aug 2008
        • 15

        #4
        Can you post the piece of code here

        Originally posted by shahidrasul
        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

        Comment

        • tlhintoq
          Recognized Expert Specialist
          • Mar 2008
          • 3532

          #5
          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.

          Comment

          Working...