Hi All,
I have a TextBox in my Form and I am drawing a string into it as below.
Font myFont = new Font("Arial",18F,FontStyle.Regular,GraphicsUnit.Point,128);
Graphics g = myTextBox.CreateGraphics();
Brush b = new SolidBrush(Color.Red);
g.DrawString("Item Drawn with DrawString",myFont ,b,new PointF(1,1));
The string displayed in the TextBox. Then I tried below code
Font myFont = new Font("Arial",18F,FontStyle.Regular,GraphicsUnit.Point,128);
Graphics g = myTextBox.CreateGraphics();
TextRenderer.DrawText(g,"Item Drawn with DrawText",myFont,new Point(1,1),Color.Red);
Here the problem comes. Even though two methods g.DrawString() and TextRenderer.DrawText() uses same font, there is a difference in font style. That is some characters are rendered differently. If I use "1" instead of "128" in the font both methods will render characters as unique.
If I change GdiCharSet(128) value in font, while using g.DrawString() method there will be no effect. My question is why g.DrawString() method excludes GdiCharSet value?