All pastes #154091 Raw Edit

Miscellany

public text v1 · immutable
#154091 ·published 2006-08-30 03:54 UTC
rendered paste body
class Compound : Shape
    {
        protected List<Shape> shapes;

        
        public Compound()
        {
            shapes = new List<Shape>();
            position = new Point(10000, 10000);
        }

        public void CalculatePosition()
        {
            int intLeftMostPoint = shapes[0].GetLeftMostPoint;
            int intTopMostPoint = shapes[0].GetTopMostPoint; 

            foreach (Shape sh in shapes)
            {
                intLeftMostPoint = sh.GetLeftMostPoint();
                intTopMostPoint = sh.GetTopMostPoint();
                if (intLeftMostPoint < this.X)
                {
                    this.position = new Point(intLeftMostPoint, this.Y);
                }
                if (intTopMostPoint < this.Y)
                {
                    this.position = new Point(this.X, intTopMostPoint);
                }
            }
        }