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
 How to Add Text using OriginC?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rainlane

China
22 Posts

Posted - 07/09/2017 :  10:39:52 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Origin 94
Operating System:Window 7

In the Origin Layer , I can Rignt-Click and select Add Text to add text.



But how to achieve it by OriginC ?
At the sametime , how to set it's position ?



forum

yuki_wu

896 Posts

Posted - 07/10/2017 :  05:16:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

In Origin C, the GraphObject class provides methods and properties common to control Origin graph objects.

I wrote a simple example that may help to understand:

void AddText()
{
    GraphPage gp;
    gp.Create("Origin");
    GraphLayer gl = gp.Layers(0); // get the first layer
    if(gl)
    {
    	// add a Text named MyText
        GraphObject    	go = gl.CreateGraphObject(GROT_TEXT);
        go.SetName("MyText");
        if( go )
        {
        	go.Text = "This is a new label.";
        	go.Top = 100;
        }        
        gl.GetPage().Refresh();
    }
}


Please go to these pages for more details:
http://www.originlab.com/doc/OriginC/ref/GraphObject
http://www.originlab.com/doc/OriginC/examples/Add-Graph-Object

Regards,
Yuki
OriginLab
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