The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Set legend style and position
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

m.zaman2

Iran
5 Posts

Posted - 01/13/2016 :  08:03:29 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin 2016
Hello
How can i set Legend style and its position through originC's code. Moreover i want to add text to the graph layer, i can do it but i do not know how can i change its background style, actually i want to set back ground text as shadow style.
Could you please help me?
Thank you.

SeanMao

China
288 Posts

Posted - 01/13/2016 :  10:33:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000