Programatically set column width in DataGridView

10,831

Most specifically it appears to me you could use "AutoSizeColumsMode" = "Fill" and then set "FillWeight" on each Column to the % you were looking for.

Share:
10,831
Ayush
Author by

Ayush

I have a keen interest in the Language Development stack (Parsers, Lexers, ASTs, Compilers and VMs), Web development and Javascript frameworks (particularly AngularJS) along with security and cryptography. Lately been working on infrastructure and service monitoring, containers and Kubernetes.

Updated on June 14, 2022

Comments

  • Ayush
    Ayush almost 2 years

    I have a DGV I am binding to a list of objects. I set AutoSizeColumnsMode to Fill, so that the columns stretch to fill the entire DGV, however, currently they stretch in a way so all columns are equal width. How can i specify a weightage so that the first column be 30% of the width and the other be 70%?