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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

image opacity

Thread ID:





49115 Sep 12,2006 01:41 AM UTC Sep 12,2006 06:26 AM UTC WinForms 1
Tags: Grouping
Eric Weber
Asked On September 12, 2006 01:41 AM UTC

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



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

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon