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

Giving PlusMinus buttons a different color (GridGroupingControl)

Thread ID:

Created:

Updated:

Platform:

Replies:

70646 Dec 21,2007 02:39 PM UTC Dec 27,2007 05:11 PM UTC Windows Forms 1
loading
Tags: Grouping
Anne Thorne
Asked On December 21, 2007 02:39 PM UTC

Hello Again,

Yesterday I spent about an hour trying to get the PlusMinus buttons a different color, not a different theme, but a differnt color -- we would like to use a dark blue (System.Drawing.Color.FromArgb(123, 134, 154))
to match the color scheme of our windows application.

Is this possible, I cannot see any examples of this being done in any of your work.

For instance, the following link shows only a themed PlusMinus button:

http://www2.syncfusion.com/ug_61/gridwin/Apperance.html


Thank you so much for all of the help you give us all.
:) Anne at Arbonne.com


haneefm [Syncfusion]
Replied On December 27, 2007 05:11 PM UTC

Hi Anne,

You need to subscribe to the grid's TableControlDrawCell event for drawing the cells. There you can use e.Inner.Graphics.FillRectanlge to draw the backcolor and then set e.Inner.Cancel = true to indicate you have handled the drawing. Below are the codes:

void gridGroupingControl1_TableControlDrawCell(object sender, GridTableControlDrawCellEventArgs e)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
if (style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell)
{
e.Inner.Cancel = true;
e.Inner.Graphics.FillRectangle(new SolidBrush(Color.Red), e.Inner.Bounds);
e.Inner.Graphics.DrawRectangle(Pens.Black, e.Inner.Bounds);
Element el = style.TableCellIdentity.DisplayElement;
string text = el.ParentGroup.IsExpanded ?"-":"+";
e.Inner.Graphics.DrawString(text, e.Inner.Style.GdipFont, new SolidBrush(e.Inner.Style.TextColor), new Point( e.Inner.Bounds.X + 5,e.Inner.Bounds.Y +5) );
}
}

Best regards,
Haneef



CONFIRMATION

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.

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

;