Pergunta

Is there a way I could get a better text rendering quality in window forms.

I tried playing with the "TextRenderingHint", but was of no use.

The font is Helvetica Neue LT Pro, and the desired outcome created in photoshop appears on the left of the attached image. I introduced it in .NET using the .otf file as a resource.

enter image description here

Foi útil?

Solução

Winforms doesn't support Open Type fonts. So the Windows font mapper found you a substitute TrueType font. It resembles your original font but of course doesn't render the same. Not having ClearType enabled won't improve the outcome either.

Open Type font support in Windows in general is not exactly stellar. You can typically only rely on Adobe programs to support it well, there's no decent fallback for programs that render text with GDI or GDI+. I only know of WPF as a GUI builder tool that support it. Dealing with the gratuitous Adobe product compatibility problems on Windows has a long, long history. And resembles the joy I experience having to use Flash or Reader.

Outras dicas

My advice would first be to make your image the exact size you require the button to be incorporating the required margin. Then TextImageRelation = ImageAboveText, ImageAlign = MiddleCenter, AutoSize = True and AutoSizeMode = GrowAndShrink.

This is about all you can do apart from switching to WPF and living happily ever after with your amazing WPF buttons.

I hope this helps.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top