How to set Geometry of a custom shape from code behind?

3 posts, 1 answers
  1. Dilsah
    Dilsah avatar
    2 posts
    Member since:
    Jan 2012

    Posted 10 May 2012 Link to this post

    I understand that in order to set the Geometry i need to :  

    RadDiagramShape shapeCloud = new RadDiagramShape()
        {
            Width = 180,
            Height = 100,
            Position = new Point() { X = 100, Y = 100},
            Content = "Cloud"
        };
        shapeCloud.Geometry = ShapeFactory.GetShapeGeometry(CommonShapeType.CloudShape);
    But what i really want is something like :
        shapeCloud.Geometry = "M16.35,6.39 C16.28,7.36 12.26,20.45 12.26,20.45 L20.56,20.45 C20.56,20.45 16.64,7.54 16.53,6.39 z M12.30,0.50 L20.97,0.50 L32.50,33.50 L24.54,33.50 L22.23,26.16 L10.70,26.16 L8.42,33.50 L0.50,33.50 z"
    Is there a way to do that?
    Thanks


  2. Answer
    Francois Vanderseypen
    Francois Vanderseypen avatar
    46 posts
    Member since:
    Oct 2009

    Posted 10 May 2012 Link to this post


    var geo = GeometryParser.GetGeometry("M16.35,6.39 C16.28,7.36 12.26,20.45 12.26,20.45 L20.56,20.45 C20.56,20.45 16.64,7.54 16.53,6.39 z M12.30,0.50 L20.97,0.50 L32.50,33.50 L24.54,33.50 L22.23,26.16 L10.70,26.16 L8.42,33.50 L0.50,33.50 z");
    var shape = diagram.AddShape("", geo, new Point(10, 50));


    Will render the letter 'A' in your diagram.

    Fr.
  3. DevCraft banner
  4. Dilsah
    Dilsah avatar
    2 posts
    Member since:
    Jan 2012

    Posted 10 May 2012 Link to this post

    Thanks a lot!!
Back to Top