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

Giving PlusMinus buttons a different color (GridGroupingControl)

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


1 Reply

HA haneefm Syncfusion Team 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



Loader.
Live Chat Icon For mobile
Up arrow icon