Ejemplo n.º 1
0
        public override void DrawRect(CGRect dirtyRect)
        {
            base.DrawRect(dirtyRect);

            var rectFactory = CreateRectFactory(CornerRadius);

            if (!IsHidden(FillColor))
            {
                FillColor.SetFill();
                rectFactory(Bounds).Fill();
            }

            if (LineThickness > 0 && !IsHidden(StrokeColor))
            {
                StrokeColor.SetStroke();
                var halfLineThickness = LineThickness * 0.5f;
                var path = rectFactory(CGRect.Inflate(Bounds, -halfLineThickness, -halfLineThickness));
                path.LineWidth = LineThickness;
                if (LineDash.Length > 0)                // The API doesn't expect an empty line dash array (for some reason)
                {
                    path.SetLineDash(LineDash.Select(w => w * LineThickness).ToArray(), 0);
                }

                path.Stroke();
            }
        }
Ejemplo n.º 2
0
        public override void DrawRect(CGRect dirtyRect)
        {
            base.DrawRect(dirtyRect);

            StrokeColor.SetStroke();
            var path = new NSBezierPath();

            path.MoveTo(Start);
            path.LineTo(End);

            path.LineWidth = LineThickness;
            if (LineDash.Length > 0)
            {
                path.SetLineDash(LineDash.Select(w => w * LineThickness).ToArray(), 0);
            }
            path.Stroke();
        }
Ejemplo n.º 3
0
        public override void DrawRect(CGRect dirtyRect)
        {
            base.DrawRect(dirtyRect);

            FillColor.SetFill();
            NSBezierPath.FromOvalInRect(Bounds).Fill();

            if (LineThickness > 0)
            {
                StrokeColor.SetStroke();
                var halfLineThickness = LineThickness * 0.5f;
                var path = NSBezierPath.FromOvalInRect(CGRect.Inflate(Bounds, -halfLineThickness, -halfLineThickness));
                path.LineWidth = LineThickness;
                if (LineDash.Length > 0)                // The API doesn't expect an empty line dash array (for some reason)
                {
                    path.SetLineDash(LineDash.Select(w => w * LineThickness).ToArray(), 0);
                }

                path.Stroke();
            }
        }