Horrible redraw performance of the DataGridView on one of my two screens

后端 未结 9 1948
情话喂你
情话喂你 2020-11-28 03:30

I\'ve actually solved this, but I\'m posting it for posterity.

I ran into a very odd issue with the DataGridView on my dual-monitor system. The issue manifests its

9条回答
  •  野性不改
    2020-11-28 03:57

    The answer to this worked for me too. I thought I would add a refinement that I think should be standard practise for anyone implementing the solution.

    The solution works well except when the UI is being run as a client session under remote desktop, especially where the available network bandwidth is low. In such a case, performance can be made worse by the use of double-buffering. Therefore, I suggest the following as a more complete answer:

    class CustomDataGridView: DataGridView
    {
        public CustomDataGridView()
        {
            // if not remote desktop session then enable double-buffering optimization
            if (!System.Windows.Forms.SystemInformation.TerminalServerSession)
                DoubleBuffered = true;
        } 
    }
    

    For more details, refer to Detecting remote desktop connection

提交回复
热议问题