Hi,
Base on my understanding, you want to show gridlines in all display area of datagridview.
You can change AutoSizeColumnsMode property to fill. The columns will adjust their width to fill datagridview.
If rows count number is fixed, you can set the rows’ height to adjust datagridview display area.
this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.Rows.Add(3);
dataGridView1.AllowUserToAddRows = false;
foreach (DataGridViewRow r in dataGridView1.Rows)
{
r.Height = (dataGridView1.DisplayRectangle.Height - dataGridView1.ColumnHeadersHeight-1) / dataGridView1.Rows.Count;
}
If you want to show rowline dynamically, you can draw the rowlines in datagridview paint event.
The following FAQ tells about this.
13.How to make the DataGridView show gridlines in all display areas?
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/a44622c0-74e1-463b-97b9-27b87513747e#faq13
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.