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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Gradient background for entire grid

Thread ID:





802 Aug 20,2002 01:07 PM UTC Aug 22,2002 01:21 PM UTC WinForms 2
Tags: GridControl
Tony Perkins
Asked On August 20, 2002 01:07 PM UTC

Is there any way to set the grid so that it displays a single gradient background for the entire grid? I've tried setting the Interior property of the TableStyle to a gradient brush, but that just applies the same gradient brush to each of the cells in the grid. What I really want to do is set a gradient background such that the background starts with the first color in the first row and blends to the point where it displays the second color in the last row.

Clay Burch [Syncfusion]
Replied On August 20, 2002 08:31 PM UTC

One thing you could try is to create a bitmap that has the gradient that you want to see, and then set this bitmap as the backgroundimage. Here are some code snippets. int width = this.gridControl1.Bounds.Width; int height = this.gridControl1.Bounds.Height; Bitmap bm = new Bitmap(width, height); Graphics g = Graphics.FromImage(bm); LinearGradientBrush brush = new LinearGradientBrush(this.gridControl1.Bounds, Color.FromArgb(255, 250, 200), Color.FromArgb(128, 20, 20), LinearGradientMode.BackwardDiagonal); g.FillRectangle(brush, 0, 0, width, width); this.BackgroundImage = bm; gridControl1.SupportsTransparentBackColor = true; gridControl1.BackColor = Color.FromArgb(25, 204, 212, 230 ); gridControl1.TableStyle.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(50, 204, 212, 230)); gridControl1.Properties.BackgroundColor = Color.FromArgb(0, 204, 212, 230 ); One thing you would probably need to do is to resize (re-create) the bitmap whenever the grid is resized.

Tony Perkins
Replied On August 22, 2002 01:21 PM UTC

Worked like a champ. Thanks!


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

Live Chat Icon For mobile
Live Chat Icon