c# - AutoResize Not Working Properly When ColumnHeader Is Longest String -


enter image description here

dgvsampled.autoresizecolumns(datagridviewautosizecolumnsmode.allcells);

i'm trying size columns allcells mode. problem when longest string in column header, buffer left over.

compare requested column coil # column. why coil # column size content, requested column sizes large header title?

after making columns unable sorted, being sized expected them in first place.

enter image description here

from documentation (emphasis mine):

allcells: column widths adjust fit contents of cells in columns, including header cells.

from description, seems want datagridviewautosizecolumnsmode.allcellsexceptheader


Comments