何使用C#Windows窗体在DataGridView中插入Pi

何使用C#Windows窗体在DataGridView中插入Pi

本文介绍了如何使用C#Windows窗体在DataGridView中插入PictureBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞!private void PicBox(){Image img = Image.FromFile(@"D:\Work\process.gif");pictureBox1.Image = img;pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;} 这是我要在数据网格视图中插入的图片,我想在gridView中插入图片框的原因是图片是GIF和在我使用之前使用之前是动画的。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 useDataGridViewImageColumn img = new DataGridViewImageColumn();dataGridView1.Columns.Add(img);dataGridView1.Rows.Add(); 它工作正常,但使用此图片不会在列中显示动画,而是使用PictureBox可以显示动画。 问候。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.推荐答案Bitmap img;img = new Bitmap(@"c:\images\mousepad.jpg");// Create the DGV with an Image columnDataGridView dgv = new DataGridView();this.Controls.Add(dgv);DataGridViewImageColumn imageCol = new DataGridViewImageColumn();dgv.Columns.Add(imageCol);// Add a row and set its value to the imagedgv.Rows.Add();dgv.Rows[0].Cells[0].Value = img; 也许这会对你有所帮助:) -KRMaybe this would help you :)-KR 这篇关于如何使用C#Windows窗体在DataGridView中插入PictureBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-15 11:49