web analytics
How to Create DataGridView with Equal Witdh Columns? Options
codeling
Posted: Sunday, March 4, 2018 9:11:35 AM

Rank:Advanced Member
Groups: Member
Joined: 12/11/2015
Posts: 938
Points: 3945

the DataGridViewColumn.FillWeight property represents the width of the column when it is in fill mode relative to the widths of other fill-mode columns in the control. You use it to create equal width columns.

The following example create three columns with equal width in the DataGridView:

dataGridView1.AutoSizeColumnsMode =
    DataGridViewAutoSizeColumnsMode.Fill;

DataGridViewTextBoxColumn subTitleColumn =
    new DataGridViewTextBoxColumn();
subTitleColumn.HeaderText = "Subtitle";
subTitleColumn.MinimumWidth = 100;
subTitleColumn.FillWeight = 100;

DataGridViewTextBoxColumn summaryColumn =
    new DataGridViewTextBoxColumn();
summaryColumn.HeaderText = "Summary";
summaryColumn.MinimumWidth = 100;
summaryColumn.FillWeight = 100;

DataGridViewTextBoxColumn contentColumn =
    new DataGridViewTextBoxColumn();
contentColumn.HeaderText = "Content";
contentColumn.MinimumWidth = 100;
contentColumn.FillWeight = 100;

Sponsor
Posted: Sunday, March 4, 2018 9:11:35 AM
 
Users browsing this topic
Guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.


© 2018 Digcode.com. All rights reserved.