1、选中cxgridview,在属性中找OptionsView--->ColumAutoWidth,把这个属性设为True;
2、在FDMemtable的open之后加上如下代码即可
[delphi] view plain copy
for i := 0 to cxGridView1.ColumnCount - 1 do
begin
cxGridView1.Columns[i].ApplyBestFit();
end;
转载于:https://www.cnblogs.com/Thenext/p/9790578.html