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
close icon

Gradient backgrounds for a number of tools

There are a number of tools that I need to have to provide a gradient background. XPTaskBarBox''s have the ProvideItemsBackgroundBrush() but most of the other controls do not. I need to have gradient backgrounds for the other parts of the taskbar, as well as other parts of controls that don''t have gradient options

3 Replies

VA va January 20, 2006 08:43 AM UTC

Question is.. how do I do this without having to paint foreground etc....?


MJ Mano J Syncfusion Team January 20, 2006 11:42 AM UTC

Hi, You should use the XPTaskBar''s paint method and use LinearGradientBrush to draw the Gradient Background. private void xpTaskBar1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Rectangle rc = this.ClientRectangle; int gradientWidth = rc.Width; LinearGradientBrush lgb = new System.Drawing.Drawing2D.LinearGradientBrush( new Point(0, 0), new Point(0, gradientWidth),Color.White, Color.SandyBrown); float[] positions = {0.0f, 0.005f, 0.95f, 1.0f}; float[] factors = {0.4f, 1.0f, 0.05f, 0.4f}; // Blend settings Blend blend = new Blend(); blend.Factors = factors; blend.Positions = positions; lgb.Blend = blend; e.Graphics.FillRectangle(lgb, 0, 0, gradientWidth, rc.Height); lgb.Dispose(); } Please let me know if this meets your requirements. Regards, Mano


VA va January 20, 2006 05:59 PM UTC

Thanks. If I wanted to also do a gradient background or the textbox of a combobox, how would I handle that?

Loader.
Live Chat Icon For mobile
Up arrow icon