Hi Matthew,
We found it is hard to fix your original code based on the imperfect theme apply mechanism.
A general rule is that we should avoid calling GetFormat() and ApplyFormat() in a same function.
You can use GetFormat() to figure out how the treenode should look like and then set the individual node values. (it is also how we write code ourselves)
But it is recommended that you comment out that line after you test pass.
That is to say, following code should work in Origin 2016.
void SetSpecialTicks(string strFirst, string strLast)
{
GraphLayer gl = Project.ActiveLayer();
if(!gl) return;
Tree trFormat;
//trFormat = gl.GetFormat(FPB_ALL, FOB_AXIS_LABELS, TRUE, TRUE); //comment out after you test successfully
trFormat.Root.Axes.Y.Labels.LeftLabels.Custom.Begin.Type.nVal = 3;
trFormat.Root.Axes.Y.Labels.LeftLabels.Custom.End.Type.nVal = 3;
trFormat.Root.Axes.Y.Labels.LeftLabels.Custom.Begin.Label.strVal = strFirst;
trFormat.Root.Axes.Y.Labels.LeftLabels.Custom.End.Label.strVal = strLast;
int iError = gl.UpdateThemeIDs(trFormat.Root, "", "");
gl.ApplyFormat(trFormat, TRUE, TRUE);
}
PS1: theme tree is quite large, so GetFormat() is not fast, comment it out can have better performance as well.
PS2: The reason is that the tree will contain many node values after GetFormat().
One of them is the special tick count (new in Origin 2016), which is 0.
On applying, the tick count node (new) is applied after those custom tick nodes (old).
So it becomes no custom ticks finally.
Hope it is clearer now.
Max
OriginLab