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:

Created:

Updated:

Platform:

Replies:

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

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

Thanks,

eric

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 )
ia.SetGamma(0.1f);

//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.
http://www.syncfusion.com/Support/user/uploads/ImageOpacityGrid_9329fe03.zip

Let me know if this helps.
Best Regards,
Haneef

CONFIRMATION

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.

;