calculate area in c#

hi. i want to write a cod for my corel document to calculator my shape area. but i want this soft calculate area and minus the hole of that. for example if my squar is 4 cm3 and in that i have 1 cm3 another squar the app calculate that and say total area is 3cm3.

please help me.

i calculated area with cdr.activeshape.curve.area but this cand calculated total area.

  • Former Member
    0 Former Member over 7 years ago

    For calcule area like this

    I show a basic code like :

    Shapes shapes = corelApp.ActiveSelection.Shapes;
                Shape theBigOne = null;
                double area = 0;
                for (int i = 1; i <= shapes.Count; i++)
                {
                    if (shapes[i].DisplayCurve.Area > area)
                    {
                        theBigOne = shapes[i];
                        area = theBigOne.DisplayCurve.Area;
                    }
                }
                area = 0;
                for (int i = 1; i <= shapes.Count; i++)
                {
    
                    if (shapes[i] == theBigOne)
                        area += shapes[i].DisplayCurve.Area;
                    else
                        area -= shapes[i].DisplayCurve.Area;
                }
                System.Windows.MessageBox.Show(area.ToString());
    

    Developer Forum in can find cool stuffs

    https://community.coreldraw.com/sdk/f

    • hi. thanks for your code. but i want combine my shapes and then i calculate area of that in this code the app dont calculate hole of shapes. see the picture.

      i want my soft calculate the right of picture true..

      thanks...