FillPath() public méthode

public FillPath ( GraphicsPath path, Color fillColor ) : void
path PixelFarm.Drawing.GraphicsPath
fillColor Color
Résultat void
Exemple #1
0
        public override void Paint(PaintVisitor p)
        {
            Canvas g = p.InnerCanvas;
            if (fillColor.A > 0)
            {
                p.FillPath(_path, this.fillColor);
            }
            //---------------------------------------------------------  
            if (this.ImageBinder != null)
            {
                //---------------------------------------------------------  
                //Because we need external image resource , so ...
                //use render technique like CssBoxImage ****
                //---------------------------------------------------------  

                RectangleF r = new RectangleF(this.ActualX, this.ActualY, this.ActualWidth, this.ActualHeight);
                bool tryLoadOnce = false;
            EVAL_STATE:
                switch (this.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 = _imgRun.ImageBinder.Image) != null)
                            {
                                if (_imgRun.ImageRectangle == Rectangle.Empty)
                                {
                                    g.DrawImage(img, r);
                                }
                                else
                                {
                                    //
                                    g.DrawImage(img, _imgRun.ImageRectangle);
                                }
                            }
                            else
                            {
                                RenderUtils.DrawImageLoadingIcon(g, r);
                                if (r.Width > 19 && r.Height > 19)
                                {
                                    g.DrawRectangle(Color.LightGray, r.X, r.Y, r.Width, r.Height);
                                }
                            }
                        }
                        break;
                    case ImageBinderState.NoImage:
                        {
                        }
                        break;
                    case ImageBinderState.Error:
                        {
                            RenderUtils.DrawImageErrorIcon(g, r);
                        }
                        break;
                }
            }
            //--------------------------------------------------------- 
            if (this.strokeColor.A > 0
                && this.ActualStrokeWidth > 0)
            {
                p.DrawPath(_path, strokeColor, ActualStrokeWidth);
            }
        }
Exemple #2
0
 public override void Paint(PaintVisitor p)
 {
     if (fillColor.A > 0)
     {
         p.FillPath(this.myCachedPath, this.fillColor);
     }
     if (this.strokeColor.A > 0)
     {
         p.DrawPath(this.myCachedPath, this.strokeColor, this.ActualStrokeWidth);
     }
 }