Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all, I have written an app in VB.NET to display images on a DoubleBuffered panel via an 'external' trigger - For simplicity sake, lets say it uses a serial port that just takes a number and the image corresponding to the number is displayed.

At the moment, that is an array of filenames so the image file is loaded 'on the fly' rather than in some sort of cache.

The reason for this is that I potentially have a few hundred images but they are relatively small < 100kb each. I may use only a handful at a time but I do not know which ones.

The program works 'ok' but it's still not doing exactly what I want.

The issue I have is that when swapping images, the screen flickers to black before the new image is displayed. It's very minor but I'm trying to do some animation type stuff with it and some images are only displayed for 100ms or so.

Ideally, what I would like is some ideas on how I can display these images super fast and without the flicker.

One Idea I did have was to have 2 double buffered panels over the top of each other and update the images alternatively and then 'bring to front' each panel after it has updated. I presume that this would be smoother but I doubt that is the best way to do it.

I'm not after anyone to write code for me, just to throw some ideas around on the best way to accomplish what I want to achieve.

Any help would be appreciated.
Posted

are you setting the picture directly to the panels backgroundimage property. if you are, then this is probably the problem. try using the graphics object to paint the image to the control.
 
Share this answer
 
Thank you so much for that - Something simple yet very annoying!

I was using:
VB
Me.BackgroundImage = Image.FromFile(App_Path() & "Images\" & imageNames(i - 1))


and changed it to:
VB
Dim newImage As Image = Image.FromFile(App_Path() & "Images\" & imageNames(i - 1))
Dim formGraphics As Graphics = Me.CreateGraphics
formGraphics.DrawImage(newImage, 0, 0)
newImage.Dispose()


And now it works beautifully!
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900