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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

text has different spacing in focus rectangle

Thread ID:

Created:

Updated:

Platform:

Replies:

10619 Feb 6,2004 11:56 PM UTC Feb 9,2004 07:06 PM UTC Windows Forms 7
loading
Tags: GridControl
Andy Barnhart
Asked On February 6, 2004 11:56 PM UTC

I have a grid set up with defaults on all the font properties. I noticed while navigating through it, text often seems to jump left and right as the cell gets and loses focus. But not always. The attached file is a bitmap with two screen fragments in it. In the upper one, you can see exactly the same text in two rows. Looking to the right, you can see that the characters don''t line up after a bit and it gets worse as you go to the right. Further down is another shot of two rows that do stay aligned. sfprob1_3034.zip

Administrator [Syncfusion]
Replied On February 7, 2004 07:55 AM UTC

You see the diffent look when the current cell is actively being edited. When this is not the case, the text is being drawn staticly using GDI+. But when the currentcell is actively being edited, the text is drawn by the cell control which most of the this is a RichTextBox, and this control uses GDI. This is what is causing the differrent looks. And in this situation, I do not know of a way to avoid it short of writing your own edit control that uses GDI+. You can minimize by choices of certain fonts, but you will always see the little jump. You see the same type of behavior in a Windows Forms DataGrid when you have an active current cell.

Andy Barnhart
Replied On February 7, 2004 08:38 AM UTC

I am aware of the issues. In a previous version of the application, I wrote my own grid from scratch. If I had a control in a cell, I used the method for static generation of bitmaps for printing and bitblt''ed it into place. I reused the same control over and over, just changing its text, to avoid resource issues and get good performance. It is a pain, but the easy way out is too sloppy; it''s very visually disconcerting to use the arrow key to move through cells. I am aware that the grid included with VS.NET used the quick hack, leaving the door open for third party developers to do a quality job and sell some products. I am trying to get out of the "plumbing" business and spend more time solving business problems instead of lining up bits on the screen. In my mind, this is a bug.

Administrator [Syncfusion]
Replied On February 7, 2004 10:34 AM UTC

Essential Grid has support for the bitmap static drawing solution you referred to. You can take a look at the Syncfusion\Essential Suite\Grid\Samples\CellTypes\CalendarCells that uses this technique to display MonthCalendars in a cell. You can do the same thing with TextBox or RichTextBox. But your performance will probably suffer with this solution, as you are showing the control offscreen, snapping a bitmap of it, and then drawing the bitmap on screen at each static cell instead of just drawing a string. But if the jump is not what you want, then this is an option. You might be able to optimize the way your bitmaps are handled, but I think you will always have to use an active control to render the text if you want the text to appear the same in both active state and static state. Another option is to create you own edit control that renderers text exactly as the GDI+ DrawString.

Steve
Replied On February 7, 2004 11:04 AM UTC

Is there an example of creating a custom edit control?

Andy Barnhart
Replied On February 7, 2004 02:55 PM UTC

Speaking from experience, avoid that if you can. >Is there an example of creating >a custom edit control?

Andy Barnhart
Replied On February 9, 2004 01:48 PM UTC

Are you using DT_EDITCONTROL when you do your quick draw of the text while not active? It still would not be perfect, but I suspect it is not currently being used and would improve if it were. >You see the diffent look when the current cell is actively being edited. > >When this is not the case, the text is being drawn staticly using GDI+. But when the currentcell is actively being edited, the text is drawn by the cell control which most of the this is a RichTextBox, and this control uses GDI. This is what is causing the differrent looks. And in this situation, I do not know of a way to avoid it short of writing your own edit control that uses GDI+. You can minimize by choices of certain fonts, but you will always see the little jump. > >You see the same type of behavior in a Windows Forms DataGrid when you have an active current cell. >

Administrator [Syncfusion]
Replied On February 9, 2004 07:06 PM UTC

No, we use GDI+ (Graphics.DrawString) so we can easily support alphablending in static mode. I am not sure this is support with GDI without additional work. I will forward your comment onto the Grid Architect.

CONFIRMATION

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.

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

;