gpt4 book ai didi

c# - 如何在我的 DataGridViewImageColumn 中添加图像?

转载 作者:太空狗 更新时间:2023-10-29 18:27:10 24 4
gpt4 key购买 nike

我有一个字段 DataGridViewImageColumn,根据条件,我为字段的每一行添加不同的图像。有人知道我如何在 Windows 窗体中执行此操作吗?

if (dgvAndon.Rows[e.RowIndex].Cells["urgencyOrder"].ToString() == "1")
{
//Here I want to add the image in the image property field DataGridViewImageColumn.
}

最佳答案

  1. 将您的图像添加到属性文件夹下的 Resources.resx 中。 (例如 Picture1.jpeg)
  2. 在您的 DataGridView 中添加一个 DataGridViewImageColumn
  3. 以这种方式添加图像:

    for (int row = 0; row <= [YourDataGridViewName].Rows.Count - 1; row++)
    {
    ((DataGridViewImageCell)gvFiles.Rows[row].Cells[1]).Value = Properties.Resources.Picture1
    }

关于c# - 如何在我的 DataGridViewImageColumn 中添加图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17365965/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com