How to change the checkbox size based on DPI in WinForms GridControl?
By default, the WinForms GridControl will not be changed based on the current DPI. So, the checkbox will be drawn with the default size in all DPIs. In order to change the CheckBox size based on the current DPI, the CheckBoxSize property of the GridCheckBoxCellRenderer class can be used.
//To change the CheckBox size based on DPI.
GridCheckBoxCellRenderer renderer = this.gridControl1.CellRenderers["CheckBox"] as GridCheckBoxCellRenderer;
System.Drawing.Size checkboxSize = renderer.CheckBoxSize;
//Default DPI
float defaultDpi = 96;
float currentDpi;
using (Graphics g = this.CreateGraphics())
{
currentDpi = g.DpiX;
if (currentDpi != defaultDpi)
{
float scalefactor = currentDpi / defaultDpi;
renderer.CheckBoxSize = new Size((int)(scalefactor * checkboxSize.Width), (int)(scalefactor * checkboxSize.Height));
}
}'To change the CheckBox size based on DPI.
Dim renderer As GridCheckBoxCellRenderer = TryCast(Me.gridControl1.CellRenderers("CheckBox"), GridCheckBoxCellRenderer)
Dim checkboxSize As System.Drawing.Size = renderer.CheckBoxSize
'Default DPI
Dim defaultDpi As Single = 96
Dim currentDpi As Single
Using g As Graphics = Me.CreateGraphics()
currentDpi = g.DpiX
If currentDpi <> defaultDpi Then
Dim scalefactor As Single = currentDpi / defaultDpi
renderer.CheckBoxSize = New Size(CInt(Fix(scalefactor * checkboxSize.Width)), CInt(Fix(scalefactor * checkboxSize.Height)))
End If
End Using The Screenshot below illustrates the checkbox Size.

Note:
The CheckBox size can also be changed in GridGroupingControl for the current DPI in the same way.
Getting the GridCheckBoxCellRenderer
GridCheckBoxCellRenderer renderer = this.gridGroupingControl1.TableControl.CellRenderers["CheckBox"] as GridCheckBoxCellRenderer;Dim renderer As GridCheckBoxCellRenderer = TryCast(Me.gridGroupingControl1.TableControl.CellRenderers("CheckBox"), GridCheckBoxCellRenderer) Sample Link:
C#: CheckBoxSize_CS
VB: CheckBoxSize_VB
Conclusion
I hope you enjoyed learning about how to change the checkbox size based on DPI.
You can refer to our WinForms GridControl feature tour page to know about its other groundbreaking feature representations and WinForms GridControl documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!