Search code examples
c#.netremote-desktoprdphighdpi

I have a checkbox in a DataGridView that is not rendered/visible and can't be interacted with in some remote desktop sessions - how to I fix it?


Environment

RDP Target: Windows 2016 Hyper-V Server

RDP Client: Windows 10

Main Monitor of client: 1920x1080 150% scaling.

Application

C++/MFC with spawned (via COM) C# Winform, showing a Data Grid View with a number of controls, including checkboxes in cells.

C# .NET 4.6/4.7

Problem

The Checkbox does not render at all when shown. Does not happen if the RDP target is a Windows 10 client in a local Hyper-V.

Using any monitor as the RDP session host which is not 100% or 125% exhibits the problem. Problem happens at any resolution.

Workarounds

  • Using a monitor with 100% scaling, or 125% scaling.
  • Inside the target server, set the application to use 8bit colour in compatibility mode

Solution

  • The problem was that the row height was fixed, and too small. The checkbox was unable to draw.

    The following line of code solved it.

    grid.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells;