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

grid - cell editor, text "wiggling"

I’m seeing some wiggling of text (a technical term…)when clicking on cell within my (vanilla) grids. I’m guessing that the renderer active during cell editing and the general cell painter are using slightly different metrics. In my case, I am using centered text alignment (both horizontal and vertical) for the cell. It looks to me as if the active cell editor/renderer is painting the baseline of the text 1 or 2 ixels higher (ie at at a lower Y coordinate) on the screen than when the when cell is not current. I''ve uploaded a screen snippet illustrating the issue; the cell in yellow is the current cell, both the visible cells have the same font and alignment settings. I should also mention this happens on two machines I work with - both are set up with "large" screen fonts. Is there anything out there that discusses the issue and/or suggests what to do about it? best regards, -Ralph

cellrendering.zip

3 Replies

RA ralph_lachance February 18, 2006 01:17 PM UTC

btw - I don''t mean to imply that this doesn''t happen on machines with standard screen fonts installed; frankly I haven''t tried it. Will do so if you need me to. -Ralph


AD Administrator Syncfusion Team February 18, 2006 01:39 PM UTC

Ralph, you can fine tune the metrics by handling the PrepareViewStyleInfo event and changing the style.TextMargins properties. In PrepeareViewStyleInfo you chan check whether the current cell is in edit mode using: if (Grid.CurrentCell.HasCurrentCellAt(rowIndex, colIndex) && grid.CurrentCell.IsEditing) The grid uses the same metrics for both drawing and editing but with editing what complicates the issue is that some part of the alignment is also handed off to the Win32 TEXTBOX (or RichText) control. Some things to try: - Try changing style.TextMargins as discussed above. - Try using the "OriginalTextBox" celltype instead of cell type (you can also force this for all cells and derived cell types by setting Model.Option.UseRightToLeftCompatibleTextBox = true) - Try using GDI drawing. The WIn32 control editors use GDI while the grid uses GDI+ for drawing, so the font will look a bit different when editing. You can have the grid render with win32 gdi drawing by handling the DrawCellDisplayText event: void Grid_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e) { e.Cancel = GridGdiPaint.Instance.DrawText(e.Graphics, e.DisplayText, e.TextRectangle, e.Style, true); } Stefan


RA ralph_lachance March 1, 2006 01:47 PM UTC

Thanks, I''ll try your suggestions.

Loader.
Live Chat Icon For mobile
Up arrow icon