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.

GridGroupingControl Header ForeColor

Thread ID:

Created:

Updated:

Platform:

Replies:

105591 Oct 17,2012 10:01 PM Dec 12,2012 11:08 AM Windows Forms 5
loading
Tags: GridControl
John
Asked On October 17, 2012 10:01 PM

Hi,

I can't seem to change the color of the header cell.. even after following the examples.

  • ui_GridGroupingControl_Apple.ThemesEnabled = False
  • Me.ui_GridGroupingControl_Apple.Appearance.ColumnHeaderCell.Themed = False
  • Me.ui_GridGroupingControl_Apple.Appearance.ColumnHeaderCell.CellTipText = "ColumnHeader"
  • Me.ui_GridGroupingControl_Apple.Appearance.ColumnHeaderCell.Interior = New BrushInfo(GradientStyle.Vertical, Color.FromArgb(214, 220, 232), Color.FromArgb(106, 111, 151))
  • Me.ui_GridGroupingControl_Apple.Appearance.ColumnHeaderCell.TextColor = Color.White

The header cell always shows a default grey color for the text. Using the designer, I can't change the interior foreColor values as well. It defaults to Window




Vinish Kumar K [Syncfusion]
Replied On October 18, 2012 01:38 AM

Hi John,

 

Thanks you for your interested in Syncfusion products.

 

Query

Column Header color

You can set the header color in GridGroupingControl using the QueryCellStyleInfo event. Here you can the set the color for header. Please refer the following codes.

 

Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)

 

                     If e.TableCellIdentity.TableCellType = GridTableCellType.GroupCaptionCell Then

                           e.Style.CellType="Static"

                           e.Style.BackColor=Color.Blue

                           e.Style.TextColor = Color.White

                     End If

 

                     If e.TableCellIdentity.TableCellType = GridTableCellType.ColumnHeaderCell Then

                           e.Style.TextColor = Color.White

                           If e.TableCellIdentity.Column.MappingName="Col0" Then

                                  e.Style.CellType = "Static"

                                  e.Style.BackColor = Color.SteelBlue

                           End If

                           If e.TableCellIdentity.Column.MappingName = "Col1" Then

                                  e.Style.CellType = "Static"

                                  e.Style.BackColor = Color.Green

 

                           End If

                          

 

                     End If

              End Sub

 

 

Please refer the following sample file also it will helps to you. See thee below image of GGC out put

 

 

 

 

Please let me know if you have further concerns.

 

Regards,

Vinish.



Header color_674df11e.zip

John
Replied On October 18, 2012 08:00 AM

Hi Vinish,

Awesome mate. That worked.

Now, referring to your sample project,

Using, QueryCellStyleInfo, The mouse-over colors and sort direction icons do not appear.

How do I implement those or keep that intact?

Cheers,
Ash







Vinish Kumar K [Syncfusion]
Replied On November 13, 2012 06:12 AM

Hi Ash,

 

Thanks for your update.

 

Query

 

Mouse Over Color

To set the mouse over color, you can use the following events. Using this event you can set the mouse over color on enter and leaving in cell. Use these events CellMouseHoverEnter And CellMouseHoverLeave. Please refer the attached sample also it will helps to you to set the color on mouse over in header.

Query 2

Sorting icon in Static Cell

You can set the icon in Column header using the DrawCell event and DrawCellDisplayText event. Please refer the below codes.

void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)

    {

        GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;

        if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell && style.TableCellIdentity.Column.Name =="Concat" )

        {

           

            // Draw Sort-Arrow

            Brush brush = null;

            Pen pen1 = null;

            e.TableControl.Model.Options.GridVisualStylesDrawing.GetSortIconBrush(out brush, out pen1);

            Rectangle rect = e.Inner.ClipBounds;

            rect.Offset(e.Inner.ClipBounds.Width - 20, 0);

            rect.Width = 20;

            int i2 = Math.Max(0, (rect.Height - 3) / 2);

            rect.Inflate(-10, -10);

            ListSortDirection listSortDirection = ListSortDirection.Ascending;

            GridTriangleDirection triangleDirection = listSortDirection == ListSortDirection.Ascending ? GridTriangleDirection.Up : GridTriangleDirection.Down;

            GridPaintTriangle.Paint(e.Inner.Graphics, rect, triangleDirection, brush, pen1, true);

            pen1.Dispose();

            brush.Dispose();

        }

    }

 

Please refer the sample file also. It will helps to you to modify your sample.

 

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GGC_Sort2094051458.zip

 

And also refer the following UG Link it will helps to you to more details about drawCell and draw icon.

 

http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Grid/default.htm#!Documents/414135customdrawing.htm

 

 

Please let me know if you have further concerns.

 

Regards,

Vinish.


Grid Cursor Test_b402929b.zip


Gaukhar Massabayeva
Replied On December 12, 2012 06:07 AM

Hello. Is it possible to provide Grid Cursor Test in c#? Thank you

Vinish Kumar K [Syncfusion]
Replied On December 12, 2012 11:08 AM

Hi Gaukhar Massabayeva,

 

Thank you for your interested in Syncfusion products.

As per request we have modified the sample to C#. Please find the attached sample with this forum.  You can set the mouse over color on enter and leaving in cell. Use these events CellMouseHoverEnter And CellMouseHoverLeave to achieve the desired behavior.

Please let me know if you have further concerns.

Regards,

Vinish.



Helighting Row and Col header while hovering mouse on cell_2f67b3cd.zip

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.

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.

;