Problem getting the background image of a form

Posted by Deumber on Stack Overflow See other posts from Stack Overflow or by Deumber
Published on 2010-03-17T19:18:10Z Indexed on 2010/03/17 19:21 UTC
Read the original article Hit count: 268

Filed under:
|
|

I'm creating a datagridview transparent

//I got the parent background image

Bitmap parentBackGround = new Bitmap(this.Parent.BackgroundImage);

//Set the area i want to create equal to the size of my grid

Rectangle rect = new Rectangle(this.Location.X, this.Location.Y, this.Width, this.Height);

//And draw in the entire grid the area of the background image that is cover with my grid, making a "transparent" effect.

graphics.DrawImage(parentBackGround.Clone(rect, PixelFormat.Format32bppRgb), gridBounds);

When the backgroundimage of the grid's parent is show in an normal layout all work ok, but if the layout is stretch, center or any other, the transparency effent gone, have you any idea to fix it?

© Stack Overflow or respective owner

Related posts about image

Related posts about windows-forms