By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,607 Members | 1,156 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,607 IT Pros & Developers. It's quick & easy.

overriding DataGridTextBoxColumn Paint -> Any idea to be faster?

P: n/a

I 'wrote' my own DataGrid, using the normal DataGrid, and overriding some of
the DataGridTextBoxColumn-methods (mostly the Paint-method). I based most of
my changes on the Windows Form FAQ:

Basicly it works like this: Every time a cell has to be painted, it throws
an Event with an custom EventArgs-object. In that Event the specific
property's of that cell are defined and returned to my Paint-method, who
paints the cell as wanted.

I have now behaviours like:
- Custom painted column- and row-headers (image, border, color, background,
- bold/underlinded/italic text, backgroundimage, pictures, masks, ... for
each cell, depending on it's value or another value in that row etc.

The problem is: During the last year I added some new behaviours for each
new project. But it becomes slower and slower... Scroling trough the
DataGrid takes much more time than through a normal DataGrid. this isn't
abnormal offcource, because on every Paint and for every Cell an event is
thrown, and the whole logic has to be redone (checking values, select case,
if then, selecting images... etc), even if the properties of the Cell
remains the same.

So my question is: Does anybody has any idea how I could make this stuff
faster? And how to see which parts cost the most time? I alreaddy tried to
look with a Now.Tick at the beginning and the end of a function to see if it
took long time or not, but I was really surprised to see that the difference
between the ticks before and after the method was zero!

I also tried to put every Event-Args in a 2-dimensional array (for each cell
one), but even this didn't give me a noticaable difference in eprformance...

Can anybody help me? I really like my customized DataGrid, but it's really
on the edge of useable now... :-/

thanks a lot in advance,

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.