Re: How to set menu shortcuts, and fonts?



"Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx> wrote in message
news:op.t6i2pshn8jd0ej@xxxxxxxxxxxxxxxxxxxxxxx
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.

OK, for comparison, here's a screenshot of a Microsoft application under
Windows XP. Notice that the shortcuts are in their normal position in
parentheses after each menu title name:
http://www.geocities.jp/hitotsubishi/xp_shortcuts.png

The only way to do European-style shortcuts is to use names that contain
only Italian characters. That works in XP but not in Vista (as shown in the
screenshot that I mentioned yesterday).

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.

Then be surprised. Look at the screenshot that I posted yesterday. There are a ton of other surprises waiting for you too. Enough other people have already found enough surprises so that vendors persuaded Microsoft to let vendors continue offering XP to customers who can't stand Me2.

I can believe that the default user configuration is to not show the underscores unless the Alt key is pressed,

That is *not* the default. Again look at the screenshot that I posted today. Oh wait. In XP that isn't the default, but maybe this is one more thing that Microsoft screwed up in Me2. But I can't even find that option in Me2 in order to change it to match XP (besides which, I shouldn't even be looking for that option on customers' machines, only on mine).

but this _should_ be configurable in the OS and is not a C# or .NET issue.

Fine, but I still want to make my application look right. My application does look right in XP.

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?

Yes. There are these two problems that I need to solve to make my application look right. They work right out of the box when my application runs on XP, but they're ugly in Vista. These depend on settings which I did set in my C# project, as described.

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.

Understood, but I hesitated because both are settings in the same properties window in the same C# project.

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.

Fine, what should I set it to? In C++ I used to set the font to MS Shell Dlg but that doesn't seem to work in C#. The default is MS Gothic which, as discussed, works in XP but produces an ugly mixture in Vista. Do you think I should set it to Meiryo? Then maybe it should work in Vista but what would it do in XP? And what would it do in foreign versions of XP? (Somehow foreign versions of XP understand a default font of MS Gothic and they use a different font instead, which works if only Italian characters are used in the captions. I haven't seen if they'll understand Meiryo the same way.)

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.

I submitted it on the Connect site during Me2 SP1 beta testing. I don't know if "Won'tFix" implies that Microsoft acknowledges the issue as an actual problem or not, but it sure says they won't fix it. In the Connect submission, I think I attached a screenshot of the Control Panel applet that sets screen properties, in which the dialog box to set options like antialiasing had a mix of antialiased and aliased fonts in its very own self. But if I couldn't reproduce that one then I attached something pretty close to it.

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.

Wrong. MS Gothic contains all of those characters and it works correctly in XP. Meiryo contains all of those characters and it would work correctly in Me2 if Me2 would use Meiryo consistently. But even if you don't believe that, just look at the Japanese characters. Some of the Japanese characters are displayed in Meiryo (antialiased) and some in Gothic (aliased). Even if you don't believe that Japanese character sets include at least 52 Italian letters, how many character sets do you think are needed for plain old Japanese characters? (It's not always obvious whether Japanese character sets include more than 52 Italian letters, but it seems that Microsoft's fonts include some of them like é, though not some others like ś).

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?

My application has the same issue, i.e. one single font should suffice, but I don't know how to persuade Vista to use one single font.

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.

Then you should have done some studying before even replying to this issue.

I hope for a reply from someone who really knows how to fix it. I wonder if I need to post a new thread now in hopes of getting snagged by Microsoft.

.