JumpyNET Posted September 14, 2006 Posted September 14, 2006 (edited) I'm using the following code to draw a rotated string inside a circle to a picture box. Any ideas how I could make the picture quality better for the text? I was thinking something like making it first bigger and then smaller - but don't know how to accomplish this. I'm also having problems positioning the text inside the circle. Note that the text width can change. 'This function will draw a circle with rotated text inside it. 'This should be the centerpoint of the text and circle Dim CenterPoint As System.Drawing.Point = New System.Drawing.Point(20, 60) 'Declarations Dim GraphicObject As Graphics Dim BitmapObject As Bitmap BitmapObject = New Bitmap(PictureBox1.Width, PictureBox1.Height, PictureBox1.CreateGraphics) GraphicObject = Graphics.FromImage(BitmapObject) 'Let's draw a circle GraphicObject.DrawEllipse(New Pen(Color.Blue, 5), CenterPoint.X, CenterPoint.Y, 50, 50) 'Let's draw rotated text inside the circle GraphicObject.TranslateTransform(CenterPoint.X, CenterPoint.Y) GraphicObject.RotateTransform(-45.0F) GraphicObject.DrawString("hh:mm:ss:ms", New Font("Arial", 8, FontStyle.Regular), Brushes.Red, 0.0F, 0.0F) GraphicObject.ResetTransform() 'Let's update the picturebox PictureBox1.Image = BitmapObject GraphicObject.Dispose() Edited September 14, 2006 by JumpyNET Quote
Leaders snarfblam Posted September 14, 2006 Leaders Posted September 14, 2006 Set the Hinting (might be TextHinting or something like that) property of the graphics object. There should be an option for anti-aliasing, an option for clear-type, and an option for aliased. That should help with the quality. Quote [sIGPIC]e[/sIGPIC]
JumpyNET Posted September 15, 2006 Author Posted September 15, 2006 Set the Hinting (might be TextHinting or something like that) property of the graphics object. There should be an option for anti-aliasing' date=' an option for clear-type, and an option for aliased. That should help with the quality.[/quote'] Thank you! I found the setting: GraphicObject.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias Never thought it could be that easy. PS: I'm still strugling with that the text centering. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.