how to make Bitmap look correct when screen resolution changed?
Hi All,
The bitmap on my application looks proper when the screen resolution is 1024*768 but it disturbed when I change the screen resolution to 800*600.
1)How can I make it look constant on all the resolutions?
2)And I'm using 15 inches moniter, but how can I make my bitmap to
adjust on any screen size, say, 17 inces or 21 inches etc..?
Your advices are very much appriciated.
Thanks.
[444 byte] By [
shinde] at [2007-11-20 11:53:28]

# 1 Re: how to make Bitmap look correct when screen resolution changed?
I never had such a problem with my bitmaps/icons.
How do you show your bitmaps? Are you using "picture" controls (static with SS_BITMAP style) or do you draw them yourself? If the latter - please, show your code.
# 2 Re: how to make Bitmap look correct when screen resolution changed?
HI VictorN,
Actually I'm changing Main Frame background by overriding OnEraseBkgnd() function.
I have a bitmap which im loading and using as a background for mainframe by using CreateCompatibleDC() and CreateCompatibleBitmap() fucntions.
And finally I'm calling BitBlt() function.
And one more info, my window (mainframe) is always maximized size.
Please let me know if im missed any info.
Thanks.
shinde at 2007-11-11 4:03:27 >

# 4 Re: how to make Bitmap look correct when screen resolution changed?
There are simple answers, but they're usually incomplete.
You must stretch the bitmap to fit, but fitting all resolutions and aspect ratios, as well as quality of the stretch, are issues to consider.
First, you can simply use stretchblt. This lets you stretch to fit, bit it's not a great quality stretch (or shrink), and if you do it 'live' on every paint (erase), it's not that fast.
Resolutions on high end monitors can easily reach 1600 x 1200 pixels. If your source bitmap is 1024 x 768, then while your aspect ratio is correct, the stretching will cause the image to appear grainy. Your source image should be close to one of higher resolutions you intend to target. Simply expanding a smaller image into a larger one doesn't 'create' information in the image - you should work from higher resolution original source images instead.
Wide format displays are becoming more common, which brings to the problem the aspect ratio question, and how to handle it. Standard monitors have a 4/3 resolution ( 800/600 = 1024/768 = 1600/1200). However, wide monitors have 16/9 resolution (perhaps others exist, too).
Even stranger, the resolution may not reflect the aspect ratio of the hardware the user owns. For example, I can set my 21" CRT (which is physically a 4/3 monitor) to a 1600 x 900 resolution. The resolution suggests the aspect is 16:9, but the monitor displays at 4/3. Aspect ratio 'corrections' are usually required for such situations (circles aren't circular until you do).
At some point, most novice and early intermediate developers give up and choose a common resolution and let the others just 'understand' they're an oddball. If you really want to support all the resolutions and aspect ratios, you have to accept the fact that it's not as simple as choosing a means of painting the image. You have to process the image.
Even the act of shrinking or expanding an image has about it several algorithms, each with their own features, for which you'll need an image processing library that supports the features. There are several, just google and select among the free image libraries that you research, or just find the various image resize algorithms and choose the one you want.
To start you off, though, you can just research stretchblt. If the results are acceptable for now, move on and restudy the subject when you really need to understand it.
JVene at 2007-11-11 4:05:24 >
