I have an Access database with pictures and other data stored. I want to show the picture from the database in a DatagridView.
This works but the image height is very small in the DatagridView. I also want to stretch the image.
How do I do this ?
Here is where I bind the data from the Access database to the datagridview:
conn.Open();
OleDbCommand cmd = new OleDbCommand(cmdstr, conn);
DataTable table = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(table);
DatagridView1.DataSource = table;
conn.Close();
With this code I created a column to show the picture, but I can't bind the data from the database to this column.
DataGridViewImageColumn photoColumn = new DataGridViewImageColumn();
photoColumn.DataPropertyName = "Photo";
photoColumn.Width = 200;
photoColumn.HeaderText = "Image";
photoColumn.ReadOnly = true;
photoColumn.ImageLayout = DataGridViewImageCellLayout.Normal;
DatagridView1.Columns.Add(photoColumn);