Here's the OnPaint method of a control that simply inherits from control and provides a property to get/set the textrenderinghint:
Private _mode as TextRenderingHint = SystemDefault.
Public Property Mode as TextRenderingHint
Get & Set _mode
...
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim g = e.Graphics
Dim savMode = g.Save
g.TextRenderingHint = Me._mode
g.DrawString(Me.Text, Me.Font, Brushes.Black, 0, 0)
g.Restore(savMode)
MyBase.OnPaint(e)
End Sub
Now, if you place two of these on a form, leave the first as default and change the second to AntiAlias, it looks fine at design-time but when you run the app, the first label's rendering mode has changed. Its as if the DrawString method has changed the systemdefault.
Here's some observations:
(1) If I explicity set the first control's mode to ClearTypeGridFit, which is the same as the default in my case, it fixes the problem.
(2) If you place a third control on the form and leave at the default mode, it fixes the problem.
(3) TextRenderer.DrawText doesn't replicate the problem.
(4) If I inherit label control and override the onpaint method to set the rendering mode, the problem is not replicated even though I set UseCompatibleTextRendering - which forces the label to render with DrawString instead of DrawText.
I'm on XP with cleartype enabled and using visual studio 2008 express edition.
ETA: I've tried it in C# and the same thing happens