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.

ColorEdit and Transparent color

Thread ID:





30740 Jun 22,2005 07:56 PM Jun 22,2005 08:59 PM Windows Forms 1
Tags: GridControl
Sue Harris
Asked On June 22, 2005 07:56 PM

Hi, I''ve got a grid with a ColorEdit cell. If the user selects the Transparent colour from the ColorEdit it throws an "This control does not support transparent background colors." exception. Is there a way to either (a) allow the ColorEdit to select Transparent (preferable); or (b) remove invalid colours from the ColorEdit colour list? You can duplicate this problem by running the CellStyles sample, changing a cell to ColorEdit cell type, then in the cell selecting Transparent. Thanks, Sue

Administrator [Syncfusion]
Replied On June 22, 2005 08:59 PM

The reason this is happening is the the control in the cell is derived from TextBoxBase, and this WindowsForms control does not accept Transparent colors with its default settings. You can try directly calling Control.SetStyles through reflection to change this setting. (This method is protected, so you cannot directly call it.
GridDropDownColorUICellRenderer cr = this.gridControl1.CellRenderers["ColorEdit"] as GridDropDownColorUICellRenderer;
TextBoxBase ui = cr.TextBox;
System.Reflection.MethodInfo mInfo = typeof(Control).GetMethod("SetStyle", 
	System.Reflection.BindingFlags.Instance | 
	System.Reflection.BindingFlags.InvokeMethod | 
if(mInfo != null)
	mInfo.Invoke(ui, new object[]{ControlStyles.SupportsTransparentBackColor, true});


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.