The problem is with the Show property. Origin C TreeNode has a built-in property called Show and thus a tree tagName called Show will lead to a conflict. We can fix this in later SR but for now, you can use lower case "show", since the theme tree tagname is case insensitive.
The following code will work fine:
void show_top_right_axes()
{
GraphLayer gl = Project.ActiveLayer();
if( !gl )
return;
Tree trFormat;
// first turn on top-right axes with a separate set theme call
trFormat.Root.Axes.X.Ticks.TopTicks.show.nVal = 1;
trFormat.Root.Axes.Y.Ticks.RightTicks.show.nVal = 1;
int nErr = gl.UpdateThemeIDs( trFormat.Root ) ;//assign node IDs to all nodes in trFormat, return number of errors
if(0 != nErr)
out_str("Fail to Update Theme IDs, theme tree has wrong structure");
gl.ApplyFormat( trFormat, true, true, true ); //update graphlayer's format
// then change settings can be done after needed axes are already turned on
trFormat.Root.Axes.X.Ticks.BottomTicks.Major.nVal = 1; // Set the major ticks to In & Out format for X axes
trFormat.Root.Axes.Y.Ticks.LeftTicks.Major.nVal = 1; // Set the major ticks to In & Out format for Y axes
trFormat.Root.Axes.All.Ticks.All.Color.nVal = SYSCOLOR_BLUE; // Set the color of axes to bule
nErr = gl.UpdateThemeIDs( trFormat.Root ) ;//assign node IDs to all nodes in trFormat, return number of errors
if(0 != nErr)
out_str("Fail to Update Theme IDs, theme tree has wrong structure");
gl.ApplyFormat( trFormat, true, true, true );
}
Thanks for posting about this problem, and I have updated our ocwiki with a new example:
http://ocwiki.originlab.com/index.php?title=OriginC:Accessing_Graph_Format_with_Theme_Tree#Turn_On_Top-Right_Axes