I ran into a very odd issue with the DataGridView on my dual-monitor system. The issue manifests its
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