I recently diverged from business application programming to trying my hand (just as a hobby) at creating a card game implementation in .NET (C#). Naturally, there are some differences that I have encountered, one of which is the graphical nature of game applications.
Instinctively, I was saving all images used as the backgrounds for forms and controls as jpegs before setting them as properties in the project. Then I began to wonder if they were being embedded as bitmaps anyway, and if perhaps I was better off leaving them as .bmp files. I tried to find an answer to this question before posting here, but didn’t have any joy.
Is there a significant benefit to using jpg files over bmp when setting the BackgroundImage property at design time? For images loaded at runtime, images shipped with the application that for whatever reason exist as individual files (perhaps in a resource folder), I can see the benefit, but I’m not sure about the former.
Any insight would be appreciated.
The important thing is using a pre-computed bitmap for the image when setting the background, to improve the performance.
The code sample has been extracted from this post, that explains other techniques to improve the performance painting background images.
Hope it helps.