Shape position from a template...

Hello,
2 related questions...

1) How can I get,from a template, the position of a shape put on the diagram
I'd like to obtain the x and y coordinates...

2) What about shape sizes as Width and Height

Tnx in advance

Paolo Arrigoni




Answer this question

Shape position from a template...

  • asuleman

    Hi, I think I solved my problem.
    I realized that exist in MyClass the AssociatedPresentationElements Property that return an ArrayList. In element [0] I found an Object to wich apply a casting to MyClassShape. Now It seems working...  :)

    Microsoft.VisualStudio.Modeling.Diagrams.RectangleD
    bounds=((MyClassShape)(myClass.AssociatedPresentationElements[0])).BoundingBox;

    If someone has a better solution is welcome...  :)

    Tnx

    Paolo

     PS: No one about the second item posted in this thread regarding formatting property of a shape at runtime   :



  • Thumper III

    Tnx, Ashish for your reply,but i need some extra infos...

    My problem is I don't know how to obtain from a template a MyClassShape object to apply BoundingBox property.

    I think is possible to obtain from this.myModelRoot.myClass
    that is a MyClass type in MyCompany.MyProject.DomainModel namespace but i don't know how...

    Tnx

    Regards

    Paolo



  • Randay

    Hello Paolo,

    You can recieve a shape's size directly via the BoundingBox (relative to parent shape) or AbsoluteBounding (absolute position relative to screeen coordinates) box property of ShapeElement.

    Thanks,

    Ashish Kaila | SDET | DSL Toolkit | Microsoft


  • zhangrusi

    Are there nobody for the previous question :(

    I also need to know how to change formatting property of a shape at run time.

    What I want to do is to rapresent a window using a shape. In this window is possible to insert a label rapresented by another shape.
    A domain model property of the label is the font used and I'd like to view the font on shape changing while the user change the font property in the properties window...

    ..so I have to change at runtime the font property of a decorator accordingly to a domain model property and I don't know how to do it... :)

    Any help would be greatly appreciated...
    It's not for me, but for my thesis :>
    Tnx

    Paolo



  • Shape position from a template...