Пример #1
0
        public void CreateElements(IElementFactory factory, Rectangle bounds)
        {
            int length1 = this.dataMatrix.GetLength(0);
            int length2 = this.dataMatrix.GetLength(1);
            int left    = bounds.Left;
            int top     = bounds.Top;
            int width   = bounds.Width / this.dataMatrix.GetLength(1);
            int height  = bounds.Height / this.dataMatrix.GetLength(0);
            List <Rectangle> rectangleList = new List <Rectangle>();

            for (int index1 = 0; index1 < length1; ++index1)
            {
                for (int index2 = 0; index2 < length2; ++index2)
                {
                    if (this.dataMatrix[index1, index2])
                    {
                        Rectangle rectangle = new Rectangle(left + index2 * width, top + index1 * height, width, height);
                        rectangleList.Add(rectangle);
                    }
                }
            }
            factory.ClearElements();
            foreach (Rectangle rectangle in rectangleList)
            {
                RectangleF rect = (RectangleF)rectangle;
                factory.CreateBarElement(rect);
            }
        }