We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Getting System.Drawing.Font Object

Hi - I''ve got a function that draws circles in your grid on the ''celldrawn'' event. After the circle is drawn, I need a way to rewrite the text of the cell on top of the circles. I''ve tried the following, which '' Write the text in the cell ON TOP of the circles. Dim sText As String = Grid1.Item(x, y).Text Dim f as System.Drawing.Font = new Font("tahoma", 10) If IsNumeric(sText) Then sText = Format(System.Convert.ToDecimal(sText), "###,###,###0") Dim rctText As RectangleF = New RectangleF(Rect.X, Rect.Y, Rect.Width, Rect.Height) Dim textSize As SizeF = g.MeasureString(sText, Font) Dim xPos As Single = Rect.X + (CSng((rctText.Width / 2) - (textSize.Width / 2))) Dim yPos As Single = Rect.Y + (CSng((rctText.Height / 2) - (textSize.Height / 2))) g.DrawString(sText, f, New SolidBrush(Grid1(x, y).TextColor), xPos, yPos) The problem is, I have no way to convert the Syncfusion.Windows.Forms.Grid.GridFontInfo object that I get from e.style.font to a System.Drawing.Font object that I can use in the Drawstring method. Any suggestions? Thanks very much in advance, Damien

1 Reply

AD Administrator Syncfusion Team July 29, 2005 12:30 AM UTC

Try using e.style.GdiFont.

Loader.
Live Chat Icon For mobile
Up arrow icon