I
I
idShura2014-10-19 11:09:11
C++ / C#
idShura, 2014-10-19 11:09:11

How to display an image in a specific cell in a datagridview?

How can I show an image in a specific cell in a datagridview?
If you do as in the code below, then the picture will be shown in each cell, but I need only in a certain one.

DataGridViewImageColumn img = new DataGridViewImageColumn();
            dataGridView1.Columns.Add(img);
            img.DefaultCellStyle.NullValue = null;
            img.HeaderText = "";
            img.Name = "img2";
            img.Width = 20;

            Image i = Image.FromFile("1.png");
            img.Image = i;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
idShura, 2014-10-19
@idShura

Understood, virtual mode was enabled.
dataGridView1.VirtualMode = true;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question