英文:
DataGridView.row.headercell.value displays only 10 characters
问题
我有一段PowerShell代码,它使用Windows.Forms在DataGridView中显示结果,并且我想在每一行中显示索引号。但是索引值只显示从1到9,之后重置为1:
$DataGridView.Rows | % { $_.HeaderCell.Value = ($_.Index +1).ToString() }
我尝试更改为:
$DataGridView.Rows | % { $_.HeaderCell.Value = ($_.Index).ToString() }
但这没有产生结果。
英文:
I have powershell code that displays the result in DataGridView using windows.forms and I want to display the index number in each row. But the index values are only displayed from 1 to 9, and after that it is reset to 1:
$DataGridView.Rows | % { $_.HeaderCell.Value = ($_.Index +1).ToString() }
I tried to change
$DataGridView.Rows | % { $_.HeaderCell.Value = ($_.Index).ToString() }
But it doesn't produce results
答案1
得分: 1
@jdweng 谢谢。我调整了RowHeaders的大小。
$datagridview.RowHeadersWidthSizeMode = 'AutoSizeToDisplayedHeaders' $datagridview.AutoResizeRowHeadersWidth($datagridview.RowHeadersWidthSizeMode)
现在一切都正常。
英文:
@jdweng thx. I resized RowHeaders
$datagridview.RowHeadersWidthSizeMode = 'AutoSizeToDisplayedHeaders' $datagridview.AutoResizeRowHeadersWidth($datagridview.RowHeadersWidthSizeMode)
And now everything works.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论