Click here to Skip to main content
16,004,778 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void PicBox()
{
Image img = Image.FromFile(@"D:\Work\process.gif");
pictureBox1.Image = img;
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
}

this is Picture I want to insert in data grid view, the reason i want to insert the picture box in gridView is that the Picture is GIF and is animated, before i have used before i have use
C#
DataGridViewImageColumn img = new DataGridViewImageColumn();
dataGridView1.Columns.Add(img);
dataGridView1.Rows.Add();

it works fine, but using this the picture does not show the animation in the column, but by using PictureBox the animation could be shown.

Regards.
Posted

C#
Bitmap img;
img = new Bitmap(@"c:\images\mousepad.jpg");
// Create the DGV with an Image column
DataGridView dgv = new DataGridView();
this.Controls.Add(dgv);
DataGridViewImageColumn imageCol = new DataGridViewImageColumn();
dgv.Columns.Add(imageCol);
// Add a row and set its value to the image
dgv.Rows.Add();
dgv.Rows[0].Cells[0].Value = img;

Maybe this would help you :)

-KR
 
Share this answer
 
Comments
xibit89 18-Feb-14 1:12am    
Hello KR,
i have already applied this, but this is returning the image with no animation.
Krunal Rohit 18-Feb-14 1:23am    
Your image must be in .gif format.

-KR
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900