简体   繁体   中英

Why is my DGV.MinimumWidth being ignored?

With this code:

const int COMMENTS_COLUMN_DESIRED_WIDTH = 412;
...
dgv.Columns[COMMENTS_COLUMN].DefaultCellStyle.WrapMode = DataGridViewTriState.True;
                dgv.Columns[COMMENTS_COLUMN].MinimumWidth = COMMENTS_COLUMN_DESIRED_WIDTH;

...the COMMENTS column wraps, as I want it to, but after a width of maybe 120 pixels, nowhere near 412. Why is it wrapping before it hits its MinimumWidth value?

The data does not contain line breaks where the wrap is occurring.

我将AutoSizeColumnsMode从“ AllCells”更改为“ None”,并且达到了目的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM