ComboBox with Segoe UI and Japanese text

2019-07-17 06:10发布

问题:

I’m currently trying to make my C# application look better when run within Windows Vista or Windows 7. By default, Windows Forms applications use the Microsoft Sans Serif font, which does not link properly to Asian clear type fonts such as Meiryo.

To fix this issue, I set all the fonts to Segoe UI (or SystemFonts.MessageBoxFont) instead. This works quite well for most of Controls, but I noticed it causes weird display glitches with at least the ComboBox control:

The ComboBox fails to display this list correctly. Characters get cropped oddly and the selected item looks like it requires more space than originally reserved.

Is there any solution or workaround to this behaviour?

In case you want to try it for yourself, here's my list of items:

  • テスト
  • てすと
  • 実験

Thanks!

回答1:

I repro on Win7. Something is borked in the font mapper by the looks of it, the substitute font is clearly too large. Notable is the problem does not occur with Microsoft Sans Serif. And it maps just fine on my machine.

Tough to give cheap advice here, you really need the help from Microsoft Support. You also ought to check it on the Japanese version of Windows, odds are decent that it will have fonts that don't require mapping.



回答2:

I had a similar problem (but with some other characters and font) not sure if it will work for you but it is quite simple to implement the DrawItem event and draw the text yourself.

We use a method similar to this: https://stackoverflow.com/a/857232/417721