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.
Syncfusion Feedback

How to specify a gradient or other brush for the GroupBar's GroupBarItem background

 

The GroupBar control permits programmatic assignment of any System.Drawing.Brush derived class for drawing the GroupBarItem background region through the GroupBarItem.BackgroundBrush property.

The following code excerpt demonstrates creating and assigning a GradientBrush for one of the GroupBarItem objects.

C#

// Set up the Blend for the GradientBrush

Blend blend = new Blend();

blend.Factors = new float[] {0.0f, 0.0f, 1.0f};

blend.Positions = new float[] {0.0F, 0.5f, 1.0F};

// Estimate the GroupBarItem bounds

Rectangle rcgroupbaritem = new Rectangle(0, 0, this.groupBar1.Width, this.groupBar1.GroupBarItemHeight);

// Create and initialize the LinearGradientBrush

LinearGradientBrush lgbrush = new LinearGradientBrush(rcgroupbaritem, Color.White, Color.Red, 0, true);

lgbrush.Blend = blend;

// Assign the gradientbrush to the GroupBarItem1 of GroupBar1

this.groupBarItem1.BackgroundBrush = lgbrush;

VB

' Set up the Blend for the GradientBrush

blend As Blend = New Blend()

blend.Factors = New Single() {0.0f, 0.0f, 1.0f}

blend.Positions = New Single() {0.0F, 0.5f, 1.0F}

' Estimate the GroupBarItem bounds

rcgroupbaritem As Rectangle = New Rectangle(0, 0, Me.groupBar1.Width, Me.groupBar1.GroupBarItemHeight)

' Create and initialize the LinearGradientBrush

lgbrush As LinearGradientBrush = New LinearGradientBrush(rcgroupbaritem, Color.White, Color.Red, 0, True)

lgbrush.Blend = blend

' Assign the gradientbrush to the GroupBarItem1 of GroupBar1

Me.groupBarItem1.BackgroundBrush = lgbrush

Article ID: Published Date: Last Revised Date: Platform: Control:
1068 04/30/2011 07/10/2014 Windows Forms GroupBar
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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