public override void Draw(Canvas canvas)
        {
            base.Draw(canvas);

            FiapBoxView boxView = (FiapBoxView)Element;

            Rect ret = new Rect();

            GetDrawingRect(ret);

            Rect inside = ret;

            inside.Inset((int)boxView.EspessuraDaBorda, (int)boxView.EspessuraDaBorda);

            Paint paint = new Paint();

            paint.Color = boxView.Color.ToAndroid();

            canvas.DrawRect(inside, paint);
            paint.Color       = boxView.CorDaBorda.ToAndroid();
            paint.StrokeWidth = (float)boxView.EspessuraDaBorda;
            paint.SetStyle(Paint.Style.Stroke);

            canvas.DrawRect(ret, paint);
        }
Example #2
0
        public override void Draw(Canvas canvas)
        {
            base.Draw(canvas);

            FiapBoxView boxView = (FiapBoxView)Element;

            Rect ret = new Rect();

            GetDrawingRect(ret);

            Rect inside = ret;

            inside.Inset((int)boxView.EspessuraDaBorda, (int)boxView.EspessuraDaBorda);

            Paint paint = new Paint();

            paint.Color = boxView.Color.ToAndroid();

            canvas.DrawRect(inside, paint);
            paint.Color = boxView.CorDaBorda.ToAndroid();

            paint.StrokeWidth = (float)boxView.EspessuraDaBorda;
            paint.SetStyle(Paint.Style.Stroke);

            canvas.DrawRect(ret, paint);

            //Botão Personalizado

            //FiapButton btnView = (FiapButton)Element;

            //ret = new Rect();
            //GetDrawingRect(ret);

            //inside = ret;
            //inside.Inset((string)btnView.Texto, (string)btnView.Texto);

            //paint = new Paint();
            //paint.Color = btnView.Color.ToAndroid();

            //canvas.DrawRect(inside, paint);

            //paint.StrokeWidth = (float)btnView.Texto;
            //paint.SetStyle(Paint.Style.Stroke);

            //canvas.DrawRect(ret, paint);
        }
        public override void Draw(CGRect rect)
        {
            FiapBoxView boxView = (FiapBoxView)Element;

            using (var context = UIGraphics.GetCurrentContext()) {
                context.SetFillColor(boxView.Color.ToCGColor());
                context.SetStrokeColor(boxView.CorDaBorda.ToCGColor());
                context.SetLineWidth((float)boxView.EspessuraDaBorda);

                var ret = Bounds.Inset((int)boxView.EspessuraDaBorda,
                                       (int)boxView.EspessuraDaBorda);

                var path = CGPath.FromRect(ret);
                context.AddPath(path);
                context.DrawPath(CGPathDrawingMode.FillStroke);
            }
        }