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

Gradient background for entire grid

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.

2 Replies

CB Clay Burch Syncfusion Team 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.

TP Tony Perkins August 22, 2002 01:21 PM UTC

Worked like a champ. Thanks!

Live Chat Icon For mobile
Up arrow icon