Board index » Visual Studio » different DPI's and dialog control layout
|
subsniper
|
|
subsniper
|
different DPI's and dialog control layout
Visual Studio67
From what I understand, when I create a dialog in the editor it is created for a 96 DPI screen. How do I deal with different DPI's? When I take my dialog app to a different screen ( at a different DPI ) everything moves around. I am trying to have my controls line up on a background image, so placement is important. TIA - |
| AliR
Registered User |
Tue Jul 17 10:35:11 CDT 2007
Re:different DPI's and dialog control layout
Read these articles. I am not an expert in DPI aware programing, but I have
used the info in these articles with my Windows XP apps and they work. msdn2.microsoft.com/en-us/library/ms838191.aspx">msdn2.microsoft.com/en-us/library/ms838191.aspx msdn2.microsoft.com/en-us/library/ms969894.aspx">msdn2.microsoft.com/en-us/library/ms969894.aspx AliR. "Golum256" <Golum256@discussions.microsoft.com>wrote in message QuoteFrom what I understand, when I create a dialog in the editor it is created - |
| Joseph
Registered User |
Sun Jul 22 03:11:34 CDT 2007
Re:different DPI's and dialog control layout
Generally, this is a fundamentally losing idea. Dialogs are dynamically resized based on
a HUGE number of parameters OTHER than dpi (display size, display driver behavior, default user font, phase of the moon, angular separation of Mars and Jupiter, who knows?) so the basic premise is that you have NO control over what is happening. There is no guaranteed correct solution, because the windows resize as appropriate. Frankly, I had one of these programs cross my desk about ten years ago, and the first thing I did was convince the client that the whole idea was fundamentally unsound. We simply removed the fancy bitmap from the background. However, there are some alternatives, but none of them are pleasant. You will have to deal with the fact that ifyou create a bitmap of fixed size, it won't localize very well (the controls may need more space in German, or Finnish, for example), it won't work if the user is (like me) visually impaired (it's called "being over 45") and has selected a default font larger than the normal linstalled font. So you would need a bitmap that had a layout suitable for every possible combination of driver, screen size, resolution, and default font selection (and I haven't even gotten into the issues of high-contrast support for people who are seriously visually handicapped, or who need to use really large fonts). But we had one situation where we were putting maps up on the screen. What we did with those maps is do edge detection of areas of the map, and resize the controls to fit into those areas. However, this worked because the areas were ALWAYS substantially larger than the captions that were associated with them. We got away with it because we had a different problem to solve. If you assume localized bitmaps, and just make active areas on the bitmap, then it is easier than placing controls. For exmple, for a pushbutton I was able to fit the pushbutton into the region in question, but I created an owner-draw pushbutton with and empty DrawItem handler, so what I ended up with was a reactive section of the bitmap. So you have to fit the controls to the bitmap, and this has to be done by parsing the bitmap. I know of no other reliable way of accomplishing this (The situation we had was the original program was designed for a 640x480 screen, and the entire OnInitDialog handler had MoveWindow calls with absolute positions in them. Then all their customers got 800x600 monitors, but wanted the app to run full-screen, and it was absolutely insane. It didn't help that a lot of the laptops of those days did not support 256 colors and the fancy background used a 256-color bitmap. My own display was already 1024x768, and I explained that every display was going to require a new bitmap and massive changes in the program, most likely the thing to do would be to create a configuration map that mapped controls to rectangles and this, too, would be a maintenance nightmare. Given I was about to add 50 controls to the dialog to add the features they wanted (in addition to the 800x600 enhancement) I considered this whole plan to be a truly abysmal design. I still consider it abysmal design) joe On Tue, 17 Jul 2007 08:08:02 -0700, Golum256 <Golum256@discussions.microsoft.com>wrote: QuoteFrom what I understand, when I create a dialog in the editor it is created Web: www.flounder.com">www.flounder.com MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm - |
