LayoutFarm.HtmlBoxes.CssBoxImage.Paint C# (CSharp) Méthode

Paint() public méthode

public Paint ( PaintVisitor p, RectangleF rect ) : void
p PaintVisitor
rect PixelFarm.Drawing.RectangleF
Résultat void
        public override void Paint(PaintVisitor p, RectangleF rect)
        {
            PaintBackground(p, rect, true, true);
            if (this.HasSomeVisibleBorder)
            {
                p.PaintBorders(this, rect, true, true);
            }
            //--------------------------------------------------------- 
            RectangleF r = _imgRun.Rectangle;
            r.Height -= ActualBorderTopWidth + ActualBorderBottomWidth + ActualPaddingTop + ActualPaddingBottom;
            r.Y += ActualBorderTopWidth + ActualPaddingTop;
            r.X = (float)Math.Floor(r.X);
            r.Y = (float)Math.Floor(r.Y);
            bool tryLoadOnce = false;
        EVAL_STATE:
            switch (_imgRun.ImageBinder.State)
            {
                case ImageBinderState.Unload:
                    {
                        //async request image
                        if (!tryLoadOnce)
                        {
                            p.RequestImageAsync(_imgRun.ImageBinder, this._imgRun, this);
                            //retry again
                            tryLoadOnce = true;
                            goto EVAL_STATE;
                        }
                    }
                    break;
                case ImageBinderState.Loading:
                    {
                        //RenderUtils.DrawImageLoadingIcon(g, r);
                    }
                    break;
                case ImageBinderState.Loaded:
                    {
                        Image img;
                        if ((img = (Image)_imgRun.ImageBinder.Image) != null)
                        {
                            if (_imgRun.ImageRectangle == Rectangle.Empty)
                            {
                                p.DrawImage(img,
                                      r.Left, r.Top,
                                      img.Width, img.Height);
                            }
                            else
                            {
                                p.DrawImage(img, _imgRun.ImageRectangle);
                            }
                        }
                        else
                        {
                            RenderUtils.DrawImageLoadingIcon(p.InnerCanvas, r);
                            if (r.Width > 19 && r.Height > 19)
                            {
                                p.DrawRectangle(Color.LightGray, r.X, r.Y, r.Width, r.Height);
                            }
                        }
                    }
                    break;
                case ImageBinderState.NoImage:
                    {
                    }
                    break;
                case ImageBinderState.Error:
                    {
                        RenderUtils.DrawImageErrorIcon(p.InnerCanvas, r);
                    }
                    break;
            }

            //#if DEBUG
            //            p.FillRectangle(Color.Red, rect.X, rect.Y, rect.Width, rect.Height);
            //#endif
        }