N
N
nubic2018-05-08 16:48:45
C++ / C#
nubic, 2018-05-08 16:48:45

Is it possible to increase the speed of hiding columns in a DataGridView?

There is a massive DataGridView (about 150 columns),
you need to hide 60 columns out of these 150, as a result, we get a drawdown in the formation for 8 seconds, because hiding (Visible = false) is set at 130-150ms for each column, is it somehow treated? Didn't google anything that works

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VoidVolker, 2018-05-08
@VoidVolker

myControl.SuspendLayout();
... меняем контент в myControl ...
myControl.ResumeLayout(false);
myControl.PerformLayout();

There is one more additional flag for the form which can speed up rendering:
public partial class MainWindow : Form
    {
        /// <summary>
        /// Fix for slow UI rendering
        /// </summary>
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x02000000;  // Turn on WS_EX_COMPOSITED   
                return cp;
            }
        }
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question