Drawing text in .NET with native look & feel
I'm using .NET1 and I want to draw text as native. Is it开发者_如何学C possible by configuring graphics?
I need to render the text as the System.Windows.Forms.Label does when the FlatStyle is set to System.
I have configured the SmoothingMode and the AntiAliasGridFit, but unfortunately the result is not the same:
I'm using the same font in both cases (Segoe UI 9pt).
Any ideas?
Have you tried using the TextRenderer
class instead of the Graphics.DrawString
routine? It was introduced into the framework precisely because there is a discrepancy between the default rendering of Windows Forms and .NET’s GDI+ wrapper.
The MSDN says:
The TextRenderer class provides a set of static methods that can be used for measuring and drawing text on a Windows Form control.
精彩评论