How to set a baground image for datagrid in c# [Resolved]

Posted by Chaithragm under C# on 11/29/2013 | Points: 10 | Views : 19118 | Status : [Member] | Replies : 5
How to set the background image to a datagrid control




Responses

Posted by: t5j9033387989 on: 11/29/2013 [Member] Starter | Points: 50

Up
0
Down

Resolved
try with this one,

Image backgroundimage;

private void Form1_Load(object sender, EventArgs e)
{
backgroundimage= Image.FromFile(@"E:\Images\riverphoto.jpeg");
}

private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
DataGridViewRow row = dataGridView.Rows[e.RowIndex];
row.DefaultCellStyle.BackColor = Color.Transparent;
}

private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
e.Graphics.DrawImage(backgroundimage, e.RowBounds);
}


mark this answer if it will really help you,

Thanks&Regards
ketan

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 11/29/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer
http://www.codeproject.com/Articles/17648/Set-Image-as-Background-for-DataGridView

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 11/29/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
http://social.msdn.microsoft.com/Forums/windows/en-US/628f8b29-1192-4c67-bae9-91547dd37039/assign-background-image-to-datagridview
http://csharp.net-informations.com/datagridview/csharp-datagridview-image.htm


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chaithragm on: 11/29/2013 [Member] Starter | Points: 25

Up
0
Down
Image is moving down as the rows increases

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 11/29/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
See the below link:-

http://www.dotnetspider.com/forum/130947-set-background-image-datagridview.aspx

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response