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

Apply Form.MetroStyles To GridControl

Hi,

Been trying to figure this out for a day now... lol.

  1. How do I apply metro color schemes from "Syncfusion.Windows.Forms.MetroColors" to the GridControl object?
  • My main form is using MetroForm, and I've set a Metro color to it by Me.MetroColor
  • But the Grid shows the default blue metro colors.
So basically my question is,

how do i change the metro scheme of my controls, and apply them so they
are uniform across.


Thanks...


3 Replies

VK Vinish Kumar K Syncfusion Team October 2, 2012 11:29 AM UTC

Hi John,

Thank you for your interest in Syncfusion products.

Query

Metro Color schemes to the Grid object.

Me. MetroColor only change the backcolor of icon  used in Grid. To change the color for Grid you can use the following method.

 

Way 1:

 

This can be achieved by enabling the GridVisualStyles property. Please refer to the following code snippet and let us know if this helps.

 

Me. gridGroupingControl1.GridVisualStyles = GridVisualStyles.Office2007Blue

 

Way 2 :

 

The custom visual styles can be used in which you can specify your own color for the themes on to the grid. The GridVisualStyles has to be provided as Custom, and the GridVisualStylesDrawing has to be assigned with the object that has implemented with the IVisualStylesDrawing.

 

Way 3 :

 

If you want similar colors to be applied for grid header cells, then you may do this by adding the following code to your form's constructor. Please try the code below.

 

Me.gridGroupingControl1.TableDescriptor.Appearance.RowHeaderCell.Interior =

                new BrushInfo(GradientStyle.Vertical, new Color[] { Color.FromArgb(173, 209, 255), Color.White });

Me.gridGroupingControl1.TableDescriptor.Appearance.TopLeftHeaderCell.Interior =

                new BrushInfo(GradientStyle.Vertical, new Color[] { Color.FromArgb(173, 209, 255), Color.White });

Me.gridGroupingControl1.TableDescriptor.Appearance.ColumnHeaderCell.Interior =

                new BrushInfo(GradientStyle.Vertical, new Color[] { Color.FromArgb(173, 209, 255), Color.White });


Please let me know if you have further concerns.

Regards,

Vinish.



JO John October 3, 2012 08:11 AM UTC

Hi Vinesh,

Sorry mate. I tried that but it does not apply the colors. Not sure what I'm doing wrong.

Here's the code I'm using:

Me.GridGroupingControl1.GridVisualStyles = GridVisualStyles.Metro
Dim test As BrushInfo = New BrushInfo(GradientStyle.Vertical, New Color() {Color.FromArgb(173, 209, 255), Color.Crimson})
Me.GridGroupingControl1.TableDescriptor.Appearance.RowHeaderCell.Interior = test
Me.GridGroupingControl1.TableDescriptor.Appearance.TopLeftHeaderCell.Interior = test
Me.GridGroupingControl1.TableDescriptor.Appearance.ColumnHeaderCell.Interior = test

And the result is attached.







Capture_5f3749e2.zip


VK Vinish Kumar K Syncfusion Team October 8, 2012 10:51 AM UTC

Query

Metro Color schemes to the Grid object.

We regret for the delay caused. You can use the DrawCell event to achieve the output. Using this event you can change the color for header . Please see the images we apply  the color for row header.

 

Image 1:

 

 

Image 2 :

 

 

Image 3:

 

 

Please refer the below codes for your desired output. And also refer the attached output. We hopeful this sample will helps to you.


Please let me know if you have further concerns.

Regards,

Vinish.



105330_730a8f6f.zip

Loader.
Live Chat Icon For mobile
Up arrow icon