encoree1337
encoree1337

Reputation: 337

Stretching dataGridView

I want my dataGridView collumns to stretch when I change window size, I added anchor properties to grid view, but it only resizes background, not collumns, how can I do this? My problem looks like: small window

big window

Upvotes: 0

Views: 2290

Answers (2)

TaW
TaW

Reputation: 54433

See here: MSDN on DataGridViewColumn.AutoSizeMode
and here: MSDN on AutoSizeColumnMode Enumeration

Maybe this is what you want :

All fill-mode columns in the control divide the available space in proportions determined by their FillWeight property values.

But finding out what you want is not as easy as most people think. Your images show a change not only in size bur also in font size. Is that really what you want?? I hope not, as this would surprise the user who is used to get more data on the windows when making it larger and won't expect to see larger fonts..

To get there set the properties of all columns you want to participate is the resize.

Upvotes: 0

a''
a''

Reputation: 2372

Set AutoSizeColumnsMode to Fill :)

enter image description here

Upvotes: 3

Related Questions