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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Getting System.Drawing.Font Object

Thread ID:





32405 Jul 29,2005 12:12 AM UTC Jul 29,2005 12:30 AM UTC WinForms 1
Tags: GridControl
Damien Sawyer
Asked On July 29, 2005 12:12 AM UTC

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

Administrator [Syncfusion]
Replied On July 29, 2005 12:30 AM UTC

Try using e.style.GdiFont.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon