Re: How to set menu shortcuts, and fonts?



On Thu, 14 Feb 2008 01:14:05 -0800, Norman Diamond <ndiamond@xxxxxxxxxxxxxxxx> wrote:

This involves a Windows Form in Visual Studio 2005 SP1 C# and DotNet Framework 2.

I created some menus in which every menu title and menu entry is in English. So instead of appending a shortcut letter in parentheses I used the European style of putting an & in front of a chosen letter in each actual menu title and menu entry.

I'm not sure what you mean by "European style". This is a standard Windows behavior, that goes way back to the earliest versions of the operating system. It's not "European". It's Windows.

In Windows XP this works. In the menu bar, and in each menu when opened, each shortcut letter has an underscore. In Vista this doesn't work. In both XP and Vista I have not changed the display options for shortcuts so they are still the defaults (in Vista I cannot even find that option).

While I haven't used Vista very much at all, I would be _extremely_ surprised if Microsoft changed the basic behavior of formatting a string with an underscore when a letter is preceded by the '&' in control names and menu items. It is such a basic part of the operating system behavior that to change it would be crazy.

I can believe that the default user configuration is to not show the underscores unless the Alt key is pressed, but this _should_ be configurable in the OS and is not a C# or .NET issue. I haven't used Vista enough to tell you where to look for the setting, but surely this is not a programming question.

[...]
In the main body of the form I put a DataGridView, a ListView, and some Buttons. [...] In Vista the title bar and menu bar are in Meiryo and are antialiased even at font size 9. But the DataGridView, ListView, and Buttons are all still in MS Gothic and unaliased. This combination of fonts, aliased and unaliased, makes my application look ugly.

It's hard for me to tell for sure, but I am guessing that this is a completely different problem from the underlining issue? I realize that both seem to be connected to Vista, but unless you believe that the solution to both will be the same, I think you might have posted a different thread for each issue. At the very least, I hope you can clarify that these are two completely different problems you're talking about.

Of course I'm not alone with this. Forms such as common dialogs (Open File Dialog Box) and lots of Vista's own forms have visually disturbing font mixtures like this. Microsoft closed this issue as a Won'tFix. OK, Vista's ugly, but that's no reason for my app to be ugly.

In C#, how can I set fonts to make them work in both XP and Vista?

Assuming you're using the Control-derived components in the Forms namespace, you should be able to just set the Control.Font property to control what font is used. In this way you can override the default behavior provided by .NET.

That said, this is the first I've heard of this font issue in Vista. You write "Microsoft closed this issue as a Won'tFix", which implies to me two things: Microsoft has acknowledged the issue as an actual problem, and that there's some bug report somewhere that describes the problem and their response. If you could provide a link to the bug report, I think that would go a long way toward helping other people understanding the exact nature of the problem.

Also:

Since my app is proprietary to a customer I cannot publish a screenshot of that, but here is a screenshot of a Microsoft application showing both of these problems in Vista:
http://www.geocities.jp/hitotsubishi/menus_fonts.png
In the Open File Dialog Box, most of the controls use Meiryo because Microsoft was more successful than I have been, four controls near the bottom are still in MS Gothic. The main window is mostly obscured but the menu bar is visible, and the underscores are missing from shortcut letters. Microsoft's application, like mine, does not have these problems in XP.

In the screenshot you're showing, there are a variety of character sets being displayed, which requires different fonts according to which ones support the characters used.

Does your own application have the same issue? Is the use of different fonts required due to needing specific support for specific characters in specific areas of the UI?

If not, then I don't see how that link is helpful in understanding your own question.

If so, then this isn't a Vista problem but rather just a basic issue of needing to display specific characters, and fonts not being able to support 100% of the Unicode code space. If you really need for a single font to be used and this is the issue you're having, you need to find a font that supports all of the different characters you're using, and set the controls explicitly to use that font.

Pete
.


Loading