Showing results 1 to 9 of 9

Thread: Create static Element Rectangle with certain properties and Position it in an existing picture

  1. #1
    Join Date
    28.07.2008
    Posts
    64

    Default Create static Element Rectangle with certain properties and Position it in an existing picture

    This is just a sample how to create a static Element.




    public void Macro1()

    {


    /* Create static Element Rectangle with certain properties and Position it in an existing picture. */



    zenOn.IDynPictures myPics = this.ActiveDocument.DynPictures();

    int iheight = 1008, iwidth = 1630;


    //Create rectangle
    myPics.Item("Background").Elements().Create("Rect_BackGrnd", zenOn.tpElementTypes.tpRectangle);

    zenOn.IElement myRectangle = myPics.Item("Background").Elements().Item("Rect_BackGrnd");

    //Position rectangle
    myRectangle.Left = 25;

    myRectangle.Top = 21;

    myRectangle.Width = iwidth;

    myRectangle.Height = iheight;

    //Change faceplate of rectangle
    myRectangle.BackColor = 16777215;


    myRectangle.set_DynProperties("PunchFrameType", 2);

    myRectangle.set_DynProperties("PunchFrameColor", 8092608);

    myRectangle.set_DynProperties("PunchFrameOffset", 0);

    myRectangle.set_DynProperties("PunchFrameSize", 10);

    myRectangle.set_DynProperties("PunchFrameAngle", 0);

    myRectangle.set_DynProperties("PunchFrameAlpha", 66);

    myRectangle.set_DynProperties("PunchFrameSoftFocus", 20);

    }

  2. #2
    Join Date
    16.06.2011
    Location
    N/A
    Posts
    43

    Default Re: Create static Element Rectangle with certain properties and Position it in an existing picture

    I have error :
    Error 1 'ProjectAddin.ThisProject' does not contain a definition for 'ActiveDocument' and no extension method 'ActiveDocument' accepting a first argument of type 'ProjectAddin.ThisProject' could be found (are you missing a using directive or an assembly reference?) C:\ProgramData\COPA-DATA\SQL\0a8f95d5-b6e6-42d3-858e-f12b1741048f\FILES\zenon\system\VSTA\CSharp\Projec tAddin\ThisProject.cs 25 46 ProjectAddin
    in line:
    zenOn.IDynPictures myPics = this.ActiveDocument.DynPictures();
    Click image for larger version

Name:	VSTA.jpg
Views:	32
Size:	45.9 KB
ID:	728

  3. #3

    Default Re: Create static Element Rectangle with certain properties and Position it in an existing picture

    Hi,

    The "ProjectAddin" you are using, is the VSTA workspace for the runtime.

    If you want to add a rectangle element to the screen in the editor, you need to use the "WorkspaceAddin" instead.

    The VSTA IDE for the ProjectAddin and the WorkspaceAddin is opened in different ways.

    For the ProjectAddin, you select the tree node "programming interfaces" and here you can choose to open the VSTA IDE for the workspace for anything in the runtime.

    For the WorkspaceAddin, you can either press "Alt+F10" or choose to open the VSTA IDE from the "File menu" or by right clicking on the workspace itself. In the WorkspaceAddin workspace is used for anything in the editor (e.g. creating a screen, and adding a rectangle)

    Regards,
    Mark

  4. #4
    Join Date
    16.06.2011
    Location
    N/A
    Posts
    43

    Default Re: Create static Element Rectangle with certain properties and Position it in an existing picture

    Can I create Rectangle in Runtime? Do I have to use the "ProjectAddin"?

  5. #5
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default AW: Create static Element Rectangle with certain properties and Position it in an existing picture

    FYI: drawing elements via the zenon API interface is no longer possible with the upcomming version zenon 7 (this feature was removed).

    Maybe you can give us a more detailed description what exactly you want to realize.....

    Regards,
    Herbert

  6. #6

    Default Re: Create static Element Rectangle with certain properties and Position it in an existing picture

    Hi,

    Did you know that you can make rectangles created in the editor, change in size, move position, invisible and visible and start and stop flashing in the runtime, using variables?

    Herbert is right, could you please give some more information as to why you would want to create a rectangle in the runtime dynamically?

    Regards,
    Mark

  7. #7
    Join Date
    21.05.2014
    Posts
    32

    Default Re: Create static Element Rectangle with certain properties and Position it in an existing picture

    Hello,

    I have a similar target to achieve. I create a numerous elements in Zenon explicitly to access them in VBA or VSTA would be touch sometimes (depends on the number of variables). I have an application in VB, that generates boxes in runtime using just one label in the form and loading it repeatedly with particular specified dimentions. I am looking forward to create such method in VBA or VSTA to realize in Zenon. This makes it even effective for visualization purpose and further advancements.

    Bytheway, I am using Zenon 6.51

    Regards,
    Jyothi swaroop


    Quote Originally Posted by markclemens View Post
    Hi,

    Did you know that you can make rectangles created in the editor, change in size, move position, invisible and visible and start and stop flashing in the runtime, using variables?

    Herbert is right, could you please give some more information as to why you would want to create a rectangle in the runtime dynamically?

    Regards,
    Mark
    Last edited by jyo : 4th July 2014 at 12:31

  8. #8
    Join Date
    20.01.2015
    Posts
    18

    Default Re: Create static Element Rectangle with certain properties and Position it in an existing picture

    Hey!

    Is this macro always working ?

    I write this macro in "WorkspaceAddin", but this is doesn't work!

    Where do i to call the macro ? MyWorkspace_OnWorkspaceStartup() ? MyWorkspace_OnPreVSTAUpdate() ? MyWorkspace_OnPostVSTAUpdate() ?

    Regards,

    Varnizy Loan!

  9. #9
    Join Date
    20.08.2009
    Posts
    293

    Default AW: Create static Element Rectangle with certain properties and Position it in an existing picture

    Hi,

    please have a look in the documentation,
    Manual -> Programming interfaces -> VSTA
    Escpecially here on how to execute the Macro:
    Manual -> Programming interfaces -> VSTA -> Creating a VSTA project -> VSTA projects in the editor

    If you are planning to do more with VSTA I would highly recommend visiting a zenon API training.

    Kind regards,
    Bernhard

Similar Threads

  1. Create a function for a trend picture
    By robertf in forum VBA
    Replies: 8
    Last Post: 4th October 2018, 14:33
  2. Create an Element
    By robertf in forum VBA
    Replies: 7
    Last Post: 11th June 2014, 07:44
  3. Replies: 6
    Last Post: 1st December 2009, 12:56
  4. can't create new project in zenon editor
    By shahramkh59 in forum zenon Supervisor
    Replies: 3
    Last Post: 15th April 2009, 07:12
  5. How to create a new MACRO?
    By matholton in forum VBA
    Replies: 2
    Last Post: 24th September 2008, 12:14

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •