how to display default image in datagridview in c#.net 3.5 Win Forms?
C#
2
Posts
2
Posters
0
Views
1
Watching
-
Hi Experts, am working with c#.net 3.5, Windows Application How can i add a default image to every row of my datagridview? please help me out. Thanks In Advance. :-O
-
Hi Experts, am working with c#.net 3.5, Windows Application How can i add a default image to every row of my datagridview? please help me out. Thanks In Advance. :-O
The easiest way to do this is to use an unbound DataGridViewImageColumn. Something like this:
// Create the image column. DataGridViewImageColumn imageCol = new DataGridViewImageColumn(); imageCol.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; imageCol.ImageLayout = DataGridViewImageCellLayout.Normal; imageCol.Frozen = true; imageCol.Name = "Image"; imageCol.HeaderText = ""; // Move the column to the left // column out of the way. imageCol.DisplayIndex = 0; // By default, show the generic image. imageCol.Image = genericImage; // <==================== put your image here // Add the image column to the grid. dataGridView1.Columns.Add(imageCol);
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”