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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

buttonAdv treat it as a checkbox - glows when it has been depressed?

Thread ID:





94063 Apr 20,2010 12:46 PM UTC Apr 21,2010 09:33 AM UTC WinForms 1
Tags: Tools
David Mecteaux
Asked On April 20, 2010 12:46 PM UTC


I am wondering if its possible to use the advButton and use the Office 2007 Blue theme and when the user pushes it down to retain that depressed glow. It should retain that glow until the users pushes another advButton on the form.

I was trying to do this like:

private void buttonAdv2_Click(object sender, EventArgs e)
buttonAdv2.State = ButtonAdvState.Checked;
buttonAdv3.State = Syncfusion.Windows.Forms.ButtonAdvState.Default;

private void buttonAdv3_Click(object sender, EventArgs e)
buttonAdv3.State = ButtonAdvState.Pressed;
buttonAdv2.State = Syncfusion.Windows.Forms.ButtonAdvState.Default;

But that doesn't work.

Vallarasu S [Syncfusion]
Replied On April 21, 2010 09:33 AM UTC

Hi Dave,

You can override the OnPaint Event of the ButtonAdv Control to keep its appearance in pressed state as shown here,
ButtonAdv will be in pressed state as long as the custom added IsClicked Property is True, So update the IsClicked Property to True or False accordingly on the Buttons Click Event.

if (IsClicked)

Color cl1 = Syncfusion.Windows.Forms.Office2007Colors.Default.ButtonPressedTopColor;
Color cl2 = Syncfusion.Windows.Forms.Office2007Colors.Default.ButtonPressedBottomColor;
base.BackColor = Syncfusion.Windows.Forms.Office2007Colors.Default.ButtonPressedTopColor;
Rectangle rc = base.ClientRectangle;
Rectangle rcBrush = new Rectangle(rc.Left, rc.Top, 1, rc.Height);
using (LinearGradientBrush brush = new LinearGradientBrush(rcBrush,cl1,cl2, 90))
brush.Blend = m_blButtonPressed;
brush.WrapMode = WrapMode.TileFlipXY;
e.Graphics.FillRectangle(brush, rc);
e.Graphics.DrawString(base.Text, base.Font, Brushes.Black, base.ClientRectangle.X + 6, base.ClientRectangle.Y + 5);

Refer the sample in the following link which demonstrates the above,


Please let us know if you have any queries.

Vallarasu S.


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