RenderGraphics "Unit im mm" and "miracle cut of elipse"

Posted by: friedrich on 7 May 2020, 2:41 pm EST

    • Post Options:
    • Link

    Posted 7 May 2020, 2:41 pm EST - Updated 3 October 2022, 11:56 pm EST

    Hallo Grapecity, Hallo Prabhat, I am sure you will answer.

    1. How can I set in RenderGraphics the Unit to “mm” You see the ruler in cm but the line is in a other Unit than mm.

    2. Why is the blue elipse cuted when I remove “DrawLine” from Code. Than it is the same miracle cutting as in your sample “RenderObject”.

    Thank you for answering

    Jürgen from Germany

    Dim rg As New RenderGraphics()

    Dim ra As New RenderArea()

    rg.Graphics.PageUnit = UnitTypeEnum.Mm

    rg.Graphics.DrawLine(Pens.Green, 0, 0, 180, 100)

    rg.Graphics.DrawArc(Pens.Red, New Rectangle(0, 0, 30, 40), 0, 135)

    rg.Graphics.DrawEllipse(Pens.Blue, New Rectangle(20, 20, 90, 45))

    ra.Style.BackColor = Color.LightGray

    ra.Children.Add(rg)

    C1PD.Body.Children.Add(ra)

  • Posted 8 May 2020, 9:43 am EST

    Hi Jurgen,

    1: How can I set in RenderGraphics the Unit to “mm” You see the ruler in cm but the line is in the other Unit than mm.

    To set the page unit to Millimeter set the PageUnit property as given below:

     rg.Graphics.PageUnit = GraphicsUnit.Millimeter
    
    ```If this does not help, then please let us know what you want to convey from this point. 
    
    [b]2: [/b]The height and width of the RenderGraphics are decided by the biggest rectangle of the shapes it contains. As you set the X and Y of the Ellipses rectangle to 20 and 20 respectively so it is cutting from right and bottom. If you set it to 0,0 then it will appear fine. 
    When you add the line the rectangle of the line is bigger than Ellipses rectangle that is why it is not cutting in this case.
    When there are multiple shapes added in the RenderGraphics then the size of the shapes adjust accordingly. You can observe it by commenting on the Arc and Line code both at the same time.
    
    To show  the rectangle border of RenderGraphics object use the code snippet below: 
    

    rg.Style.Borders.All = New LineDef(“1mm”, Color.CornflowerBlue)

    Regards,
    Prabhat Sharma.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels