The DrawString from GDI+ is still a rather slow operation for drawing some simple text (like the text in a grid cell). I did a test using the GDI text functions (dllimported into .net). Turns out it's about 3 times faster than using DrawString (not using any fancy DrawString features like antialiasing and stuff).
Does anyone know if Microsoft will make any optimizations in this area?
If not, does Syncfusion consider using the old GDI for text drawing optimization?
Is it possible to build a custom cell type which draws it's text using gdi instead of gdi+ without to much effort?
ADAdministrator Syncfusion Team April 8, 2003 12:54 AM UTC
DrawString does a bit more stuff than TextOut. A better comparison would be to compare it with DrawText GDI fn because this one also does clipping, word break etc.
You should be able to derive your own cell renderer and draw text using GDI functions but I don't think it is worth the effort. You will not gain much.
The reason is that the time the grid spends doing DrawString is only a small percentage during the paint mechanism. Therefore, even if you have a routine that is faster than DrawString there are still other operations like drawing background, drawing grid lines, calculating layout and cell information.
GDI+ routines should become faster once there is better driver and hardware support from video cards, but I am not sure here what future plans are.
PVPatrick van der PlasApril 8, 2003 05:06 PM UTC
You're right...I constructed an extremely disfunctional grid myself today (only painting cells with lines and text). Just to compare the drawing speed using GDI+ for background/line painting, and GDI (DrawText) for text.
The painting of the background (FillRectangle) and lines slows it down extremely, being much slower than painting all the text using DrawText (GDI).
Using GDI+ for text aswell it slowed down again by factor X ( >2 ), making it just a bit faster than Syncfusion.Grid @ fullscreen (must be well designed considering my grid has close to zero logic ;-).
I sincerely hope Microsoft has some 'masterplan' about GDI+. Just have to wait how it will unfold, like you, I guess...Thread.Abort();