Hello everybody,

My program creates a number of dialog boxes, some with bitmaps, some with icons. These look fine on my computer but when I run it on a friend's computer the dialog boxes are not displayed at the right size, thus leaving out text/controls.

I have learned that the dialog box size is somehow affected by the size of the default font on the user's computer and there seems to be no way of forcing the dialog box to display at a size constant on all systems. Bitmaps seem to make the problem worse.

My questions:

1) Should I be using StretchBlt to set the size of the bitmaps? If so how can I determine at run time how much the dialog box size is going to be changed?

2) Should I not use bitmaps on dialog boxes?

3) Would converting the dialog box into a window help? This would be a headache cuz there are a lot of dialog boxes with a lot of controls to hand code unless someone knows of a tool to do the conversion.

Any help or suggestions would be appreciated.

best regards,

czDrillard
Posted on 2003-10-28 09:23:55 by czDrillard
Hi, czDillard.
My 0.02:

1) You can use the APIs and some math to convert DUBs (Dialog Box Units) to pixels. It must be done on runtime, and it's all in the API docs (I think the function name was GetDBUnits, but I could be wrong).

2) You can use them, but it's usually a pain in the back since you have to either resize the bitmaps or the dialog boxes. Alternatively if you're using static boxes to show icons, you could set WS_BORDER and SS_CENTER and see how well it looks with bigger fonts... :grin:

3) There are some RadAsm addins to do the conversion, but it's still some work as your DlgProc's must be converted to WindowProc's and that can only be done by hand. :(

Probably the best way to solve your problem is to resize the dialog and all it's controls when processing WM_INITDIALOG. It's not very elegant but you can get it working with little effort. However, you might then experience trouble with the font sizes...

That's the whole point of DBUs depending on the font size, so the controls will be automatically resized to fit the text always. If you hardcode pixel values in your program, you'll either have to figure out a way to resize the fonts, or use more bitmaps instead of statics.

If you also have edit boxes and the such, you should consider stretching the bitmaps instead.

Hope it helps. :)
Posted on 2003-10-28 16:27:13 by QvasiModo
Because of that reason, I don't like to use dialog resources. I use my window classes instead.
Posted on 2003-10-28 17:21:16 by JohnFound

Because of that reason, I don't like to use dialog resources. I use my window classes instead.

:grin:
But then you'd have a problem with different font sizes...
Try switching to "large fonts" (it was in the desktop properties, if I'm not wrong) and you'll see what happens when you hardcode pixel values...
Posted on 2003-10-28 17:57:06 by QvasiModo
Thanks everybody for your replies,

Stretching bitmaps it is.

Btw, pity there is no way to force users to display the fonts I choose. Afterall I knows what's best for everybody; and then I wouldn't have this problem;)


best regards,


czDrillard
Posted on 2003-10-29 09:40:00 by czDrillard