BrightIdeasSoftware.BaseRenderer.DrawImages C# (CSharp) Метод

DrawImages() защищенный Метод

Draw the given collection of image selectors
protected DrawImages ( Graphics g, Rectangle r, ICollection imageSelectors ) : int
g System.Drawing.Graphics
r System.Drawing.Rectangle
imageSelectors ICollection
Результат int
        protected virtual int DrawImages(Graphics g, Rectangle r, ICollection imageSelectors)
        {
            // Collect the non-null images
            List<Image> images = new List<Image>();
            foreach (Object selector in imageSelectors) {
                Image image = this.GetImage(selector);
                if (image != null)
                    images.Add(image);
            }

            // Figure out how much space they will occupy
            int width = 0;
            int height = 0;
            foreach (Image image in images) {
                width += (image.Width + this.Spacing);
                height = Math.Max(height, image.Height);
            }

            // Align the collection of images within the cell
            Rectangle r2 = this.AlignRectangle(r, new Rectangle(0, 0, width, height));

            // Finally, draw all the images in their correct location
            Point pt = r2.Location;
            foreach (Image image in images) {
                g.DrawImage(image, pt);
                pt.X += (image.Width + this.Spacing);
            }

            // Return the width that the images occupy
            return width;
        }