How to change the Grid Style using MapXtreme 7.1

Product affected: Mapxtreme™ 6.,7.0,7.1,7.2

Operating System: All

Database: Not stated

Configuration: Not stated
 
Sample code both for C# and VB.net How to change the grid layer style using MapXtreme 7.1

C#
==================================
MapInfo.Data.Catalog Catalog = MapInfo.Engine.Session.Current.Catalog;
MapInfo.Data.Table Grid = Catalog.GetTable("US_Elev_Grid_FT");

MapInfo.Styles.Inflection[] Inflection = new MapInfo.Styles.Inflection[9];
Inflection[0] = new MapInfo.Styles.Inflection(17000, System.Drawing.Color.Red);
Inflection[1] = new MapInfo.Styles.Inflection(100, System.Drawing.Color.Orange);
Inflection[2] = new MapInfo.Styles.Inflection(500, System.Drawing.Color.Yellow);
Inflection[3] = new MapInfo.Styles.Inflection(1000, System.Drawing.Color.YellowGreen);
Inflection[4] = new MapInfo.Styles.Inflection(3000, System.Drawing.Color.Green);
Inflection[5] = new MapInfo.Styles.Inflection(6000, System.Drawing.Color.Blue);
Inflection[6] = new MapInfo.Styles.Inflection(9000, System.Drawing.Color.BlueViolet);
Inflection[7] = new MapInfo.Styles.Inflection(12000, System.Drawing.Color.Indigo);
Inflection[8] = new MapInfo.Styles.Inflection(15000, System.Drawing.Color.Violet);

MapInfo.Styles.GridStyle GridStyle = new MapInfo.Styles.GridStyle(false, 50, 50, 50, Inflection, true, System.Drawing.Color.Red, false);
MapInfo.Styles.CompositeStyle CompositeGridStyle = new MapInfo.Styles.CompositeStyle(GridStyle);
MapInfo.Mapping.FeatureOverrideStyleModifier StyleMod = new MapInfo.Mapping.FeatureOverrideStyleModifier("US_Elev_Grid_FT", CompositeGridStyle);
MapInfo.Mapping.FeatureLayer GridLyr = mapControl1.Map.Layers["US_Elev_Grid_FT"] as FeatureLayer;
GridLyr.Modifiers.Append(StyleMod);

=======================================
Vb.net
==============================
Dim Catalog As MapInfo.Data.Catalog = MapInfo.Engine.Session.Current.Catalog
Dim Grid As MapInfo.Data.Table = Catalog.GetTable("US_Elev_Grid_FT")

Dim Inflection(8) As MapInfo.Styles.Inflection
Inflection(0) = New MapInfo.Styles.Inflection(200, System.Drawing.Color.White)
Inflection(1) = New MapInfo.Styles.Inflection(100, System.Drawing.Color.Orange)
Inflection(2) = New MapInfo.Styles.Inflection(500, System.Drawing.Color.Yellow)
Inflection(3) = New MapInfo.Styles.Inflection(1000, System.Drawing.Color.YellowGreen)
Inflection(4) = New MapInfo.Styles.Inflection(3000, System.Drawing.Color.Green)
Inflection(5) = New MapInfo.Styles.Inflection(6000, System.Drawing.Color.Blue)
Inflection(6) = New MapInfo.Styles.Inflection(9000, System.Drawing.Color.BlueViolet)
Inflection(7) = New MapInfo.Styles.Inflection(12000, System.Drawing.Color.Indigo)
Inflection(8) = New MapInfo.Styles.Inflection(15000, System.Drawing.Color.Violet)

Dim GridStyle As MapInfo.Styles.GridStyle = New MapInfo.Styles.GridStyle(False, 50, 50, 50, Inflection, True, System.Drawing.Color.Red, False)
Dim CompositeGridStyle As New MapInfo.Styles.CompositeStyle(GridStyle)
Dim StyleMod As MapInfo.Mapping.FeatureOverrideStyleModifier = New MapInfo.Mapping.FeatureOverrideStyleModifier("US_Elev_Grid_FT", CompositeGridStyle)
Dim GridLyr As MapInfo.Mapping.FeatureLayer = MapControl1.Map.Layers.Item(0)
GridLyr.Modifiers.Append(StyleMod)
UPDATED:  September 1, 2017