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

GDI Font Issues

If using GDI to draw text on a grid, the draw does not limit the text area drawn to the cell rectangle. Please see the attached example in which GDI text overflows (vertically) into other cells whereas pressing the GDI+ button limits the text ot just the currenct cell. GDIFont_9823.zip Thanks, Steve

4 Replies

AD Administrator Syncfusion Team September 29, 2004 01:42 PM UTC

I forgot to mention that I am using 2.1.0.30. Have you duplicated this issue in your system? Thanks, Steve


AD Administrator Syncfusion Team September 29, 2004 05:44 PM UTC

Hi Steve, we''ll add a ForceDrawText field to GridGDIPaint Here is how you can workaround it for now: protected override void OnDrawCellDisplayText(GridDrawCellDisplayTextEventArgs e) { base.OnDrawCellDisplayText (e); if (UseGDI) { // in future versions: // GridGdiPaint.ForceDrawText = true; // -or- // e.Style.Trimming = System.Drawing.StringTrimming.Character; // Workaround for now: e.Style.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; // but this draws also ellipsis at end ... e.Cancel = GridGdiPaint.Instance.DrawText(e.Graphics, e.DisplayText, e.TextRectangle, e.Style); } } This is explanation for ForceDrawText that we will add: /// Specifies if GDI DrawText routine should always be used and text should be clipped. When you /// set this true the performance of the GDI drawing routine will be the same as for GDIplus DrawString /// since text needs to be clipped everytime it is drawn. If you want to force GDI DrawText on a cell /// by cell basis you can specify style.Trimming = System.Drawing.StringTrimming.Character instead /// and leave ForceDrawText = false. public static bool ForceDrawText = false; Stefan


AD Administrator Syncfusion Team September 30, 2004 12:22 PM UTC

Thanks for the response. Currently, I am not setting e.Style.Trimming so next version this should work since the default for this setting is StringTrimming.Character. Is this something I could open a direct trac incident to get a private build? Thanks, Steve


AD Administrator Syncfusion Team September 30, 2004 05:04 PM UTC

I checked in those changes. So, yes you can submit a incident and support will send you a private patch when it is available. Good you mentioned that the default is StringTrimming.Character. I might need to change that again then slighlty or point that out to programmers who have high update scenarios so they are aware of it ... I will mention that in the GridGDIPaint docs in case I make changes again. Stefan

Loader.
Up arrow icon