Hi,
Please try out the following function:
void forzaman()
{
GraphLayer gl = Project.ActiveLayer(); // Make sure active graph window is the right one
GraphObject gLegend = gl.GraphObjects("Legend");
gLegend.X = 3; // Set Legend X position to coordinate value 3
gLegend.Y = 3; // Set Legend Y position to coordinate value 3
if(gl)
{
// add a Text named MyText
GraphObject gText = gl.CreateGraphObject(GROT_TEXT);
gText.SetName("MyText");
gText.Text = "New Label";
Tree trFormat;
//If you want to see all controlling options for added text object
// run two commmented out lines below
// trFormat = gText.GetFormat(FPB_ALL , FOB_ALL, TRUE, TRUE);
// out_tree(trFormat); // output format tree for added tex
trFormat.Root.Background.Shadow.Style.nVal=1; // Turn on shadow for added text
if( 0 == gText.UpdateThemeIDs(trFormat.Root) ) // Apply settings
{
gText.ApplyFormat(trFormat, true, true);
}
}
}
If you want to see more information about the format tree of text object, please run the commented out two lines.
Regards!
Sean
OriginLab Tech.