How to set menu shortcuts, and fonts?

N

Norman Diamond

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. 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).

In C#, how can I set shortcuts to display properly in both XP and Vista?

In the main body of the form I put a DataGridView, a ListView, and some
Buttons. I have not changed the font setting so the form and all controls
still have the default. Visual Studio 2005 SP1 shows the font as MS Gothic.
In C++ I used to change this to MS Shell Dlg so that exported versions would
use a font suitable to whatever countries' languages, but C# seems not to
have this, so I have just left the default setting unchanged. Again, in XP
this works. In XP the form and all controls are in MS Gothic, and the
display is consistent (without antialiasing because the minimum for
antialiasing is somewhere around 18 or so). In Vista this gets scrambled.
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.

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?

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.
 
P

Peter Duniho

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
 
N

Norman Diamond

Peter Duniho said:
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).
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.
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.
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.
 
P

Peter Duniho

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

"Normal" for whom? It's normal for character-based languages, because the
letters used for the shortcuts aren't part of the language. But it's not
normal for the vast majority of the people reading your message.
The only way to do European-style shortcuts is to use names that contain
only Italian characters.

What's Italian got to do with it? Do you mean Roman letters, the
un-accented characters used in a wide variety of Western languages?
Then be surprised.

Why? You've yet to demonstrate that using an '&' character in a string
for menu and control text in Vista doesn't provide the usual underlining
in appropriate situations.

All you've shown is that it's possible for the underlining to not be
visible at all times. But XP can do this too, and it's a matter of user
configuration, not of programming practice. So that doesn't prove
anything.
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.

Ah. I see. It seems this is less about you wanting help with your
program, and more about you wanting to rant about Vista.

There is no such operating system as "Windows Me2". You cannot expect to
be taken seriously as someone who warrants attention and help if you
insist on taking your rants so far that you can't be bothered to write the
actual name of the operating system.
That is *not* the default.

Apparently, it is. If it weren't, wouldn't you be getting underlines for
shortcut key letters?
Again look at the screenshot that I posted today.

The screenshot you posted today doesn't include any underlined
characters. How does that dispute the suggestion that in Vista the
default is to not show underlined characters?
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).

I'm sorry you can't find the option in Vista. But that's not a
programming issue. You need to talk to someone who can help you configure
your Vista installation to work as you desire.
Fine, but I still want to make my application look right. My
application does look right in XP.

Any given application can take on a wide variety of appearances depending
on operating system configuration. This is especially true when using
operating-system-provided user interface elements.

For some things, you can do things in code to help make things look
right. But for other things, such as the formatting behavior for dealing
with shortcut keys, this is under operating-system control, and you need
to look into operating system configuration settings to deal with it.
[...]
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#.

Meaning what? _How_ doesn't it work? Do you get an error? Does it just
not show the font you expected? Does it show the font, but fail to do
something else you expected?
The default is MS Gothic which, as discussed, works in XP but produces
an ugly mixture in Vista.

Well, for the record, I don't have MS Gothic installed on my copy of XP.
It sounds like a font that may be particular to whatever localized version
you have, or maybe it came with some other Microsoft software or something.

As far as the "ugly mixture" goes, I had the impression from your previous
post that the mixture is due to different fonts appearing in the same
window. Are you saying that even applying MS Gothic to every user item
element results in a mixture?
Do you think I should set it to Meiryo? Then maybe it should work in
Vista but what would it do in XP?

If you don't deliver the font with your application, the OS will
substitute one. Possibly one you don't like. So if you take that
approach, one thing you may want to do is check the OS version and/or
installed fonts and choose a font explicitly on the basis of that
information.
And what would it do in foreign versions of XP?

Define "foreign". As near as I can tell, relative to my own installation
of XP, the version you are using _is_ foreign.

It's funny...Americans are often accused (rightly so) of being
culture-egocentric. But right now, you're the one who seems to be
treating his own localized version as "the" locale.

Your questions would be a lot easier to understand if you would be clear
about what localizations you're dealing with and why your system is
configured the way it is. So far your posts have presented information
referring to Italian and Japanese, both of which would be considered
"foreign" in an English-language forum such as this one.
[...]
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.

As I wrote, you should include a link to that bug report if you want
people to fully understand your question and Microsoft's response.
[...]
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.

Then use MS Gothic. I don't have it installed on my system so I can't
confirm that it supports all of the different character sets. But if
you're right that it does, just use that font.
[...]
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.

Why not? What code have you tried and what doesn't work when you try it?
This is a programming newsgroup. If you want help with your program, you
really should post a concise-but-complete code sample that reliably
demonstrates whatever problem it is you're having.

And if that problem is dependent on a specific configuration and/or
localization, you need to be very specific about those prerequisites and
how to achieve them, and of course hope that someone reading your message
either is using that configuration and/or localization, or is willing to
configure/install their version of Windows as such.
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.

The only replies that will appear here from Microsoft are generally in
response to messages posted by MSDN subscribers. If you are an MSDN
subscriber then you should get a reply, whether or not you start a new
thread.

If you're not, then it's extremely unlikely that anyone from Microsoft
would reply and you're stuck with people who frankly have a lot lower
tolerance for insolence and ranting than a paid professional from
Microsoft would have. Use that information as you see fit.

Frankly, I hope for your sake that someone else fields your question and
provides an answer. I don't see what's so wrong about trying to help even
when one doesn't have exactly the answer you were hoping for, and I don't
see why you expect perfection in a forum like this one. But your approach
to the question and your attitude about Vista and my own reply aren't
likely to encourage me or anyone else to really want to put a lot more
effort into pursuing an answer.

Pete
 
P

Peter Duniho

[...]
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).

I'm sorry you can't find the option in Vista. But that's not a
programming issue. You need to talk to someone who can help you
configure your Vista installation to work as you desire.

Or, just do a Google search (which is probably what you should have tried
before posting your question here).

In less than 120 seconds, I came up with this thread (along with a bunch
of others that are similarly helpful):
http://groups.google.com/group/micr...read/thread/2bfc7347b3d9bcf1/e76cab7e67fb14dc
 
N

Norman Diamond

Peter Duniho said:
"Normal" for whom? It's normal for character-based languages, because the
letters used for the shortcuts aren't part of the language. But it's not
normal for the vast majority of the people reading your message.

Microsoft doesn't do everything wrong. Among things they did right, they
set a convention for showing shortcuts ... up to but not including Vista.
What's Italian got to do with it? Do you mean Roman letters, the
un-accented characters used in a wide variety of Western languages?

Yes, I think Italian characters and Roman characters mean the same as each
other. I've seen a lot of people refer to them as English, as though
English copies were different from Spanish copies or French copies, but the
unaccented ones seem to me to be the same as the originals.
Why? You've yet to demonstrate that using an '&' character in a string
for menu and control text in Vista doesn't provide the usual underlining
in appropriate situations.

You mean I haven't posted enough screenshots of it? You need more
screenshots of the same thing?
All you've shown is that it's possible for the underlining to not be
visible at all times. But XP can do this too, and it's a matter of user
configuration, not of programming practice. So that doesn't prove
anything.

In XP it was there by default.

Your later message pointed to a discussion archived on Google, from which I
understand that Vista changed the default.

So for my app to work nearly consistently between XP and Vista, I have to
use the usual method of showing shortcuts (putting them in parentheses after
the main wording of each caption) instead of the European method (putting an
ampersand in the middle of the main wording itself, in front of whatever
letter to be highlighted). I don't think I should force every end user to
find how to change their Windows settings, and make changes which would
affect every app on their system, just to make my app display properly.
Ah. I see. It seems this is less about you wanting help with your
program, and more about you wanting to rant about Vista.

Well, my original posting said what it meant. You kindly pointed out that
you haven't used Vista enough to know whether your other suggestions were
going to be useful or accurate, and I thank you for that degree of honesty.
As well, since you haven't used Vista enough, a lot of things that have
caused people to compare Vista to ME are still waiting for you to discover
them too. After you use Vista a bit maybe you'll be calling it Me2 too.
Though you won't have to rediscover the experiences of other developers
using Visual Studio 2005 on Vista, since Visual Studio 2008 is out now.
Apparently, it is. If it weren't, wouldn't you be getting underlines for
shortcut key letters?

Yup, in XP, 2003, 2000, NT4, 98, and 95, displaying shortcuts with
underlines by default and not needing any changes. I'm not going to waste
time installing ME (the non-Vista one) to see if it was the same.
The screenshot you posted today doesn't include any underlined characters.

My God.
Menu title ファイル(F) has the F underlined.
Menu title 編集(E) has the E underlined.
Menu title 表示(V) has the V underlined.
Menu title 挿入(I) has the I underlined.
Menu title 書å¼(O) has the O underlined.
Menu title ツール(T) has the T underlined.
Menu title メッセージ(M) has the M underlined.
Menu title ヘルプ(H) has the H underlined.
How does that dispute the suggestion that in Vista the default is to not
show underlined characters?

I think my previous message observed that your previous message had a point,
the default in Vista might have changed from the default of previous
versions of Windows. So you're not always wrong either. I think you're
still right that an XP example doesn't dispute the possibility that
Microsoft might have made this one more change to Vista without me noticing
until now.
For some things, you can do things in code to help make things look right.
But for other things, such as the formatting behavior for dealing with
shortcut keys, this is under operating-system control, and you need to
look into operating system configuration settings to deal with it.

Then the solution will be to put shortcut letters in parentheses at the end
of a caption even if the caption is entirely Roman letters.
Meaning what? _How_ doesn't it work? Do you get an error? Does it just
not show the font you expected? Does it show the font, but fail to do
something else you expected?

IT SHOWS A MIXTURE OF ALIASED AND UNALIASED FONTS.
IT DOESN'T SHOW A CONSISTENT FONT LIKE XP AND PREVIOUS
WINDOWS VERSIONS DID.
OK, if repetitions didn't get this point across then neither will shouting.
This is getting pretty frustrating anyway.
Well, for the record, I don't have MS Gothic installed on my copy of XP.

Right, foreign versions of XP don't have all the fonts installed unless you
choose them either during setup or later from Control Panel. Vista has them
regardless of language version.
As far as the "ugly mixture" goes, I had the impression from your previous
post that the mixture is due to different fonts appearing in the same
window.

Bingo, thank you for understanding this issue properly.
Are you saying that even applying MS Gothic to every user item element
results in a mixture?

Essentially yes. I didn't have to do "applying" because Visual Studio set
it that way by default and I didn't have to change it. This can still be
considered "applying" even when Visual Studio is the one doing the applying.
Yes this results in a mixture in Vista (and not in XP).
If you don't deliver the font with your application, the OS will
substitute one.

I wonder if Microsoft allows redistributing OS fonts with an application,
since they don't allow that with Office fonts. But wait, even if they allow
it, what would this do? Vista already has Meiryo built in so redistribution
would be a no-op. XP doesn't have Meiryo built in so maybe it could be
installed, but why would we want one app to use Meiryo in XP?
one thing you may want to do is check the OS version and/or installed
fonts and choose a font explicitly on the basis of that information.

Hmm, figure out if we're running on Vista and then at run time change all
the font settings from MS Gothic to Meiryo. OK, this might be a solution.

I much prefer the old C++ method, just set MS Shell Dlg in Visual Studio and
automatically get whatever the end user's usual font is.
Define "foreign".

Why should I when no one else does ...
It's funny...Americans are often accused (rightly so) of being
culture-egocentric.

Yes, building and positioning a mirror takes some effort, but it has a
payoff.
Then use MS Gothic.

Yeah? How many times do I need to repeat that that is exactly what Visual
Studio set by default, that is exactly how I left it, and it results in
mixed fonts in Vista? Should I shout this one too?
Why not? What code have you tried and what doesn't work when you try it?

I didn't have to do any coding, Visual Studio's form designer has a property
window for each form, and one of the properties is the form's font. Some of
the individual controls have font properties too. Visual Studio defaults
them all to MS Gothic and I didn't have to change any of them ... well for
XP I didn't have to change any of them.
The only replies that will appear here from Microsoft are generally in
response to messages posted by MSDN subscribers. If you are an MSDN
subscriber then you should get a reply, whether or not you start a new
thread.

Sometimes yes and sometimes no. For more than a year Microsoft was ignoring
my messages, and then I discovered accidentally that they had cut the
connection between my posting alias and my membership ID. They wouldn't let
me reestablish that connection because my posting alias already existed even
though its connection had been cut. So I had to create a new posting alias.
But even so, when Microsoft observes that a posting has a reply, they might
decide that there's no need for them to reply too.
 
N

Norman Diamond

As an experiment, in Visual Studio 2008 running on Vista, in the form's
properties window, I changed the font to Meirio. Visual Studio 2008
automatically multiplied nearly every coordinate of control locations and
sizes by about 1.2 in order to adjust for average differences in character
sizes -- and it didn't tell me it was doing so. As an exception, it didn't
adjust the size of the form itself, so some controls were relocated off the
form and no longer visible.

Since I have code to respond to form resize events and relocate controls, I
have to adjust my code to contend with new sizes. I'm thinking about this.
Push buttons ballooned in size unnecessarily, so I want to restore those to
original sizes. Column widths in a DataGridView really do need widening,
but the overall width doesn't need as much widening as Visual Studio did.

I copied the executable back to an XP machine which doesn't have Meirio
font. Now this experimental version of the application has a mixture of
aliased and unaliased fonts on XP. Roman letters are displayed in a font
which looks somewhat like Meiryo, antialiased and rather wide. It reminds
me of a font that some Java applications use, but I don't know the name.
Chinese and Japanese letters are displayed in something that still looks
like MS UI Gothic, but maybe size 10 instead of the standard 9. Looking at
Visual Studio again, the properties window still says font size 9 not 10.

I'm half inclined to stick with MS UI Gothic and let my application get
mixed fonts on Vista as it has been doing, i.e. maybe decide on the same
"Won't Fix" as Microsoft decided on for its own windows.
 
N

Norman Diamond

The font situation has a pretty simple partial solution which was pretty
hard to find. Just add one line of code to the class constructor for each
form:
this.Font = SystemFonts.IconTitleFont;

Recomputing all the sizes and locations of child controls will still be a
pain though. The .Net Framework does a recomputation based on differences
between the average size of the original developer's default font on the
Windows system where the original developer initially created the form, and
the average size of the font that is assigned here. The .Net Framework
applies these recomputations to some controls (for example buttons where
maybe the result looks ugly) and not to others (for example DataGridView
columns where maybe it's needed). So if I assign the correct font then I
have to do all the recomputations myself. Still wondering if I want to do
it or not. For applications that will be used by non-technical end users
it's probably mandatory to do it.
 
L

Linda Liu \(CS&S\)

Hi Norman,

I haven't installed VS2008 on my Vista machine, so I couldn't verify the
problem so far that the form isn't resized when its font is changed. I'll do
an experiment later.

But I do a test on VS2005 on Vista and the result is that the form is
resized when I change the font of the form. I mean the problem you mentioned
doesn't exist in VS2005 at least.

When running an application on a machine, if the font that the application
requires isn't installed on the machine, another font will be used. This
behavior is by design.

If your problem is still not solved, it'd be better if you could send me a
simple project that could just reproduce the problem. To get my actual email
address, remove 'online' from my displayed email address.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support Engineer
within 1 business day is acceptable. Please note that each follow up
response may take approximately 2 business days as the support professional
working with you may need further investigation to reach the most efficient
resolution. The offering is not appropriate for situations that require
urgent, real-time or phone-based interactions or complex project analysis
and dump analysis issues. Issues of this nature are best handled working
with a dedicated Microsoft Support Engineer by contacting Microsoft Customer
Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
N

Norman Diamond

By coincidence at this moment I have the form open in VS2005 on Vista, so I
tested exactly the same change there. In the properties window for the
form, I changed the font from MS UI Gothic to メイリオ (Meirio). VS2005
resized and relocated most of the child controls but VS2005 did not resize
the form, so a button in the lower right is now outside of the form.
I mean the problem you mentioned doesn't exist in VS2005 at least.

It does. The same exact problem exists in VS2005.
When running an application on a machine, if the font that the application
requires isn't installed on the machine, another font will be used.

Right, which will make recomputations of size and locations even more
troublesome. I think I found the simplest partial solution about 2 minutes
before your posting, so I'll copy it here. Just add one line of code to the
class constructor for each form:
this.Font = SystemFonts.IconTitleFont;

That will take effect at execution time instead of compile time. Then the
..Net Framework recomputes sizes and locations of some controls (for example
buttons where maybe the result looks ugly) and not others (for example
DataGridView columns where maybe it's needed). In order to contend with
this, I have to recompute them all myself. I haven't decided yet whether to
do this or just leave the Vista font mixture the way it comes out by
default.
 
N

Norman Diamond

Ms. Liu, it is getting even worse. In VS2005, after the test which I
reported a few minutes ago, now I pressed the "undo" arrow in the toolbar.
VS2005 restored the font setting from メイリオ (Meirio) to MS UI Gothic.
The properties window shows that the font was restored, and the form in the
main design window is now showing all the captions in MS UI Gothic again.
BUT: VS2005 did not restore the sizes and locations of the child controls
to what they used to be. So the button in the lower right is still outside
of the form.

Now I have to delete this test copy and recreate this test copy from the
original. No problem, it will just take a few minutes. But imagine if I
had trusted VS2005 with these operations on the actual copy of the project.
 
N

Norman Diamond

Ms. Liu,

Last Friday I responded as follows to your posting:

By coincidence at this moment I have the form open in VS2005 on Vista, so I
tested exactly the same change there. In the properties window for the
form, I changed the font from MS UI Gothic to メイリオ (Meirio). VS2005
resized and relocated most of the child controls but VS2005 did not resize
the form, so a button in the lower right is now outside of the form.
I mean the problem you mentioned doesn't exist in VS2005 at least.

It does. The same exact problem exists in VS2005.

Today I think I have more information. If the project was originally
created in VS2005 SP1 + Vista hotfix on Vista then this problem doesn't
occur, so changing the font resizes the form. But if the project was
originally created in VS2005 SP1 on XP, then copied to Vista, and then
opened in VS2005 SP1 + Vista hotfix on Vista, then this problem occurs, so
changing the font doesn't resize the form, and some controls end up located
outside the form.

By the way, if a project is originally created in VS2005 SP1 + Vista hotfix
on Vista, then Visual Studio 2005 still creates the form with a default font
of MS UI Gothic instead of メイリオ (Meirio). Now in the form's properties
window, selecting the font and clicking the button to open the font setting
dialog box, Visual Studio itself has the same mixture of fonts too. In the
font setting dialog box, some controls are displayed using Meirio but most
are displayed using MS UI Gothic.
 
N

Norman Diamond

Ms. Liu, here is most of a repro:
http://www.geocities.jp/hitotsubishi/vs2005fonts.zip

The first project was created in VS2005 SP1 on XP. It was copied to Vista,
and then the second project was opened in VS2005 SP1 + Vista hotfix on
Vista, but no problem occured yet. Then another copy was made, the third
project was opened in VS2005 SP1 + Vista hotfix on Vista, and the font was
changed to メイリオ (Meirio). The problem occured almost exactly as I
stated. The Quit button is mostly off of the form.
 
L

Linda Liu[MSFT]

Hi Norman,

Thank you for your reply and sample projects!

I have downloaded the sample projects and opened the vs2005fonts_3 in
VS2005 on Vista.
I don't install the font Meirio on my Vista machine, so I change the font
of the form to some other font, e.g. Meiyo, and the form is resized.

If you change the form's font of the third project to a font other than
Meirio, does the problem still exist?

BTW, the version of the VS2005 I'm using is Version 8.0.50727.867 and the
version of the Vista on my machine is Windows Vista Enterprise.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
N

Norman Diamond

Ms. Liu,

I advise you to repro this bug on a system running Japanese versions of
Vista and Visual Studio. These are products that your company is selling in
this country. Your company really ought to test its products, you know?

Meirio is the only suitable font to choose for the third project. The
entire purpose of this discussion was to make my program look right when
running in Vista. The default setting (MS UI Gothic) produced an
unattractive mixture by default. If I intentionally chose an unsuitable
font, then my program will have an unattractive mixture by design. I do not
wish to produce that result intentionally.

Anyway now at execution time I do this:
this.Font = SystemFonts.IconTitleFont;
and then recompute the widths of all controls.
 
L

Linda Liu[MSFT]

Hi Norman,

Thank you for your reply!

But I'm sorry to tell you that we don't support non-English product &
environment issues. I suggest that you contact Microsoft CSS directly.

If the problem is confirmed to be a product bug, the case charge will be
free.
You can check http://support.microsoft.com for regional support phone
numbers.

Good luck!

Sincerely,
Linda Liu
Microsoft Online Community Support
 
N

Norman Diamond

But I'm sorry to tell you that we don't support non-English product &
environment issues.

That's not really a surprise now is it? There are a few more things
Microsoft needs to do. Stop selling non-English products and environments.
Let the world make and buy products that the world needs. Also since MSDN
managed newsgroups don't provide support for Microsoft products, stop
selling non-English MSDN subscriptions.
 
S

Steven Cheng

Hi Norman,

As for the non-English environment and products, we surely provide support
over them, and there are localized newsgroups for the same products with
english ones in community. However, due to the policy and boundary
limitation, our managed newsgroup support resource is quite restricted on
it(especially for some issues that may require complex troubleshooting or
involve more resource and engineer to work on it). As one of the active
contributors in MSDN newsgroup, we really appreciate your support and
feedback to us. For this issue, Linda has tried her best to performed
researchs and lookup in internal case archive so as to provide as much info
as possible. Anyway, we'll always be willing to assist you as much as
possible.

Thanks for your understanding.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Norman Diamond"
<[email protected]><ki#[email protected]>
 
N

Norman Diamond

Sure it takes more resources and engineers to make a product work than to
make a product not work.

Microsoft expends resources and engineers to make English language products
work.

Other companies need to expend resources and engineers to make products work
in languages used by customers of those companies. Microsoft should stop
oppressing those markets. Let other companies make products that Microsoft
doesn't want to make.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top