I made my program with Visual Studio 2012, using Winforms, and the default DataGridView
component.
It's possible change the zoom aspect of the grid?
In my particular case I need to view the grid a bit bigger, 120% or so.
I'd prefer do this at runtime, like Excel, but hardcoded is also OK.
You can use the method Scale
:
dataGridView1.Scale(new SizeF(1.2f, 1.2f));
It looks like that you want some kind of zoom, I think we just need to enlarge the Font
of the DataGridView
:
public void ZoomGrid(float f){
dataGridView1.Scale(new SizeF(f,f));
dataGridView1.Font = new Font(dataGridView1.Font.FontFamily,
dataGridView1.Font.Size * f, dataGridView1.Font.Style);
dataGridView1.RowTemplate.Height = (int)( dataGridView1.RowTemplate.Height * f);
foreach (DataGridViewColumn col in dataGridView1.Columns)
col.Width = (int)(col.Width * f);
}
//
ZoomGrid(1.5f);