Datagrid DataGridViewImageColumn set image cell

0
0

Ciao,

I can't insert an image in the cell
What am I doing wrong?
I have attached some pictures
Grazie 
Alessandro
Attachment
  • You must to post comments
0
0

private void Page1_Load(object sender, EventArgs e)
{
this.dataGridView1.RowCount = 10;
this.dataGridView1.Rows[0][0].Style.BackgroundImageSource = “Images/Wisej-256×256.png”;
this.dataGridView1.Rows[0][1].Style.BackgroundImage = new Bitmap(Application.MapPath(“Images\\Wisej-256×256.png”));
}

See attached. In general I wouldn’t use new Bitmap(), use the ImageSource property instead and deploy the /Images. This way there is no memory usage on the server to load the image and it’s also cached on the browser.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.