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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Set legend style and position

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
m.zaman2 Posted - 01/13/2016 : 08:03:29 AM
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.
1   L A T E S T    R E P L I E S    (Newest First)
SeanMao Posted - 01/13/2016 : 10:33:12 PM
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.

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000