views:

60

answers:

2

I have a WPF application rendering fonts to a larger size than I expect.

The catch is that only WPF applications I write seem to have this effect, and the problem happens only on one computer. The effect also happens with all WPF programs I write (not just one), and all windows exhit the effect.

I am using Visual Studio 2008 with .NET 3.5 SP1; all programs written in WPF.
The operating system is Windows XP with the latest service packs.
The screen resolution is 1680x1050.
Windows and buttons using Windows XP style.
Font size is Normal.
DPI setting is normal size (96 dpi).

I tested my applications on a two other computers with same OS and settings and it looks fine. My programs run on dozens of other computers and I do not see this problem.

Here is a window that looks good:
alt text

Here is a window that shows the problem (notice the button on the lower left, and the font size):
alt text

I know I can increase the width and add margin to compensate, but I need to understand why this happening. I am close to a release and I want to make sure my users do not see this effect.

All ideas appreciated.

+3  A: 

I'm not running XP right now, but I thought you could customize the size of the text that appears in window captions (and buttons) via the Display Properties (right-click desktop, select Properties, and it's the 3rd or 4th tab, I think). It lets you select colors for selected items, background colors of windows, etc.

That would be separate from setting the DPI settings.

Eric
Yes - there's a "Font size" drop down. The options are "Normal", "Extra Large", and "Large" (in that order).
ChrisF
Open Display Properties, 4th tab (Appearance) changed font size from Normal to Large Fonts and clicked Apply, then changed back to Normal and clicked Apply. Now everything looks good. Thanks for help.
Zamboni
+3  A: 

This looks like an unholy XP feature. It had the option to change the size of the system font independently from the video adapter DPI setting. Very convenient to XP users living in Easy Asia where glyphs that make up the letters are very intricate and need all the pixels they can get to make their script legible.

It is covered by Windows Forms with the Form.AutoScaleMode property, which defaults to Font instead of Dpi. WPF is however strongly biased to Dpi, the normal way of scaling.

I don't think the twain shalt ever meet. Tell your user to reset the XP setting. It is buried somewhere in the Control Panel + Display setting, I don't have it anymore to tell you exactly where to look. Or the logical alternative, changing the video DPI setting to match the font size. That's was in the Adapter tab, IIRC. Changing it from 96 to 120 DPI would be a good guess.

Hans Passant
Changing the DPI from 96 to 120 did not make any difference in this case, but thanks for the information.
Zamboni
Looks like you found the system font size setting I was talking about. Not seeing any difference in the WPF window when you change DPI isn't healthy.
Hans Passant