我需要自动调整C1FlexGrid中行高的大小。我需要使用AutoSizeRow使其工作,但它不会改变行高。我通过设置高度来测试它,它可以工作。为什么AutoSizeRow不能工作?
For i As Integer = 0 To fgrid.Rows.Count - 1
'Setting the height explicitly changes the row height
fgrid.Rows(i).Height = 32
'But AutoSizeRow() does not change the row height
fgrid.AutoSizeRow(i)
Next i发布于 2014-09-26 04:49:51
请注意,当网格的行中填充了任何数据时,AutoSizeRow方法可以工作。如果没有任何数据,AutoSizeRow就无法工作。同样的事情也发生在你的小片段里。由于行中没有数据,所以fgrid.AutoResize(i)是无用的。尝试用以下代码片段替换代码段,您将了解AutoSizeRow是如何工作的:
For i As Integer = 0 To fgrid.Rows.Count - 1
'Fill data in the cell
fgrid.Rows(i)(1) = "This is sample text"
'Setting the height explicitly changes the row height
fgrid.Rows(i).Height = 32
'AutoSizeRow() is changing the row height now
fgrid.AutoSizeRow(i)
Next ihttps://stackoverflow.com/questions/26045040
复制相似问题