0

I have this application that works on all computers except when using the following display settings on windows 7 (I reproduced the issue on several computers):

enter image description here

And this is what my application looks like when using this setting: Cells are mostly blacked out toward the right side of the datagridview. If I try to scroll up/down, the cells/fonts scramble and everything looks impossible to read.

enter image description here

I checked this solution, tried it, but the issue persists. Interestingly, the issue only affects the datagridview.

Is this a common Microsoft glitch or is it something that could be fixed with code? I have some co-workers that use the above mentioned display settings.

Community
  • 1
  • 1
Pucho
  • 370
  • 2
  • 20

1 Answers1

0

I kept doing some research and I found that the DoubleBuffered property for the datagridview is off by default and it is somewhat "hidden", so basically it is not possible to just turn it on without having to do some coding.

With that said, even though the code I'm posting below is an answer from another question that is also found here, I thought it would be a good idea to, instead of deleting the question, expand on the cases where DoubleBuffering can be a solution.

private void Form1_Load(object sender, EventArgs e)
     {
        typeof(DataGridView).InvokeMember("DoubleBuffered", 
        BindingFlags.NonPublic |
        BindingFlags.Instance | BindingFlags.SetProperty, null,
        mydataGridView, new object[] { true });
     }
Community
  • 1
  • 1
Pucho
  • 370
  • 2
  • 20