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.

Parents
No Data
Reply
  • Former Member
    0 Former Member over 6 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

Children