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

Cell Draw

Using the Floating cells example shipped with Syncfusion, goto a cell and hold down the i key to enter text that spans 3 cells. Press enter and you will notice that the leftmost i''s are closer togethor than the rightmost. The same occurs for other lowercase letters. This possibliy may be a GDI+ issue. Any ideas on how to work-around? (I''m using 1.8*). Thanks, Steve

7 Replies

AD Administrator Syncfusion Team April 23, 2004 12:31 PM UTC

This is a GDI+ issue. You can try using the TextRenderingHint to see if one of its settings will give you the look you want. You can do this by handling the PrepareGraphics event. (the AntiAlias is probably what you could use, but it may affect the look of your font.) Below are some code snippets. In 2.0, you can tell the grid to use GDI to draw the text, and that would avoid this problem as well.
Private Sub grd_PrepareGraphics(ByVal sender As Object, ByVal e As GraphicsEventArgs)
        ’ok: e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit
        ’ok: e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias
        ’wrong: e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit
        ’wrong: e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit
        ’wrong if cleartype is disable, ok if cleartype is enabled in system settings: e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault
        e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel
End Sub ’gridControl1_PrepareGraphics
            


AD Administrator Syncfusion Team August 31, 2004 05:25 PM UTC

How can I tell the grid to use GDI to draw. I''m currently using 2.1.0.9. Or any other work-around would be helpful. Thanks, Steve


AD Administrator Syncfusion Team August 31, 2004 06:52 PM UTC

You use the DrawCellDisplayText event. Take a look at the Grid\Samples\Performance\RefreshGrid sample.


AD Administrator Syncfusion Team September 2, 2004 01:04 PM UTC

Thanks Clay. Any change you know of an corresponding measure string that goes along with this draw? Thanks


AD Administrator Syncfusion Team September 2, 2004 02:08 PM UTC

I think you would have to use interop to access GetTextMetrics in Gdi32.lib to get the size of a string using GDI.


ST Steve June 21, 2005 04:24 PM UTC

Hi Clay, It''s my understanding that you are developing in the 2nd version of the CLR, currently in beta. I am curious to know if this GDI+ issue has been fixed in version 2 of the CLR. We have found that using GDI interface exposed by the grid is slower than using GDI+, so we are interested in using GDI+, in the upcoming release of MSFT DotNet. Thanks, Steve


AD Administrator Syncfusion Team June 21, 2005 05:14 PM UTC

This anti-aliasing support is still in .NET 2.0. You still see the letters bunch up as you type longer and longer strings.

Loader.
Up arrow icon