System.Drawing.Pen.Setup C# (CSharp) Méthode

Setup() private méthode

private Setup ( Graphics graphics, bool fill ) : void
graphics Graphics
fill bool
Résultat void
        internal void Setup(Graphics graphics, bool fill)
        {
            CGContext context = graphics.context;

            brush.Setup (graphics, fill);
            // TODO: apply matrix

            if (graphics.LastPen == this && !changed)
                return;

            //  A Width of 0 will result in the Pen drawing as if the Width were 1.
            width = width == 0 ? 1 : width;
            //width = graphics.GraphicsUnitConvertFloat (width);

            context.SetLineWidth (width);

            switch (startCap)
            {
            case LineCap.Flat:
                context.SetLineCap(CGLineCap.Butt);
                break;
            case LineCap.Square:
                context.SetLineCap(CGLineCap.Square);
                break;
            case LineCap.Round:
                context.SetLineCap(CGLineCap.Round);
                break;
            //			case LineCap.Triangle:
            //			case LineCap.NoAnchor:
            //			case LineCap.SquareAnchor:
            //			case LineCap.RoundAnchor:
            //			case LineCap.DiamondAnchor:
            //			case LineCap.ArrowAnchor:
            //			case LineCap.AnchorMask:
            //			case LineCap.Custom:
            default:
                context.SetLineCap(CGLineCap.Butt);
                break;

            }

            switch (dashStyle)
            {
            case DashStyle.Dash:
                context.SetLineDash(dashOffset,setupMorseCode(Dash));
                break;
            case DashStyle.Dot:
                context.SetLineDash(dashOffset,setupMorseCode(Dot));
                break;
            case DashStyle.DashDot:
                context.SetLineDash(dashOffset,setupMorseCode(DashDot));
                break;
            case DashStyle.DashDotDot:
                context.SetLineDash(dashOffset,setupMorseCode(DashDotDot));
                break;
            default:
                context.SetLineDash(0, new nfloat[0]);
                break;
            }
            // miter limit
            // join
            // cap
            // dashes

            changed = false;
            graphics.LastPen = this;
        }

Usage Example

Exemple #1
0
 public void DrawEllipse(Pen pen, RectangleF rect)
 {
     if (pen == null)
     {
         throw new ArgumentNullException("pen");
     }
     pen.Setup(this, false);
     context.StrokeEllipseInRect(rect);
 }
All Usage Examples Of System.Drawing.Pen::Setup