We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

image opacity

Thread ID:





49115 Sep 11,2006 09:41 PM Sep 12,2006 02:26 AM Windows Forms 1
Tags: Grouping
Eric Weber
Asked On September 11, 2006 09:41 PM

Any idea how to set an image''s opacity in QueryCellStyleInfo?



Administrator [Syncfusion]
Replied On September 12, 2006 02:26 AM

Hi Eric,

Try this code to set the optacity of the BackgroundImage in a cell.

Rectangle rect = new Rectangle(0,0,200,200);
private void gridQueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
if( e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
img = Image.FromFile("image.jpg");

//Create the Graphics object for the image.
Graphics gra = Graphics.FromImage(img);
ImageAttributes ia =new ImageAttributes();

//set the Gamma factor for optacity.
if( e.TableCellIdentity.ColIndex %2 == 0 )

//Draw the Optacity image to imagegraphics.
gra.DrawImage(img,rect ,0,0,200,200,GraphicsUnit.Pixel,ia);

//set the image as BackgroundImage.
e.Style.BackgroundImage = img;

Here is a sample.

Let me know if this helps.
Best Regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.