简体   繁体   English

如何将 DataGridView 图像单元格样式设置为拉伸?

[英]How to Set DataGridView Image Cell Style to Stretch?

I want to stretch the images displayed in a DataGridView column:我想拉伸 DataGridView 列中显示的图像:

照片

Trying to cast the last column as DataGridViewImageColumn with尝试将最后一列转换为DataGridViewImageColumn

((DataGridViewImageColumn)dataGridView1.Columns.GetLastColumn()).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

Misses some DataGridViewStatesElements arguments!错过了一些DataGridViewStatesElements参数!

Is there a better way to do this?有一个更好的方法吗?

I am pretty sure the AutoSizeMode refers to the “column”… not the image in the column.我很确定AutoSizeMode指的是“列”……而不是列中的图像。 Try…尝试…

imgCol.ImageLayout = DataGridViewImageCellLayout.Stretch;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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