c# - DataGridView and adding columns programmatically -


i need use datagridview control display large number of columns. have datagridviewcell class specifies custom paint method each cell. have added columns so...

        int columncount = 5000;         datagridviewtextboxcell cell = new datagridviewtextboxcell();         (int = 0; < columncount; i++)         {             datagridview1.columns.add(new datagridviewcolumn() { celltemplate = cell, fillweight = 1 });         } 

the problem is, takes ages add columns, longer should take. when add columns can see size of scroll bar @ bottom of datagridview getting smaller grid drawing each column each time add one.

does know of quicker way add large number of columns, or how prevent datagridview updating until columns have been added?

i've tried disabling resizing, suspendlayout(), , setting datagridview1.visible = false.

if use virtualmode = true datagridview, can refresh screen portion.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -