Reputation: 81
Hi; I have a datagridview on my project as you see in the sample picture. (Im using Visual Studio 2010). It automaticly resizes the font to fit the text in the cell. For example in the cell 2C, it reduces the font size and fit the "Faik Sozer" in the cell. But in the cell 5B, the text "Zeynep Celeplioğlu" is too long to fit, it doesnt reduce the font size and it writes "Zeynep C..." I do not want my datagridview to reduce the font size to fit the text in the cell. But i dont know how to cancel that autosize property. (I mean in the cell 2C, i want it to write "Faik Soz...", instead of resizing)
Upvotes: 0
Views: 129
Reputation: 81
I checked every property of my Datagridview and find it! "AlternatingRowsDefaultCellStyle" changes every single rows to Arial Narrow and default cellstyle for double rows. Ive changed it. Thanks for rasti. His method helped me to find it...
Upvotes: 0
Reputation: 337
you can create method to call it whenever you adding data to datagridview or when you load your data like this
private void changefont()//call this method
{
foreach (DataGridViewColumn c in dataGridView1.Columns)
{
c.DefaultCellStyle.Font = new Font("Arial", 22.5F, GraphicsUnit.Pixel);
}
}
Upvotes: 3