using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Forms;

namespace ButcherFactory.Controls
{
    public class CircleButton : System.Windows.Forms.Button
    {
        public CircleButton()
        {

            this.SetStyle(ControlStyles.AllPaintingInWmPaint |
            ControlStyles.DoubleBuffer |
            ControlStyles.UserPaint, true);
            this.ForeColor = Color.White;
            this.BackColor = Color.DeepSkyBlue;
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            path.AddEllipse(2, 2, this.Width - 6, this.Height - 6);
            Graphics g = e.Graphics;
            g.DrawEllipse(new Pen(Color.Black, 2), 2, 2, Width - 6, Height - 6);
            Region = new Region(path);
        }

        private int _minCount = 0;
        public int MinCount
        {
            get { return _minCount; }
            set {
                if (value > _maxCount)
                {
                    value = 1;
                }
                _minCount = value;
                this.Text = string.Format("{0}-{1}", _maxCount, _minCount);
            }
        }

        private int _maxCount = 1;
        public int MaxCount
        {
            get { return _maxCount; }
            set { 
                _maxCount = value;
                this.Text = string.Format("{0}-{1}", _minCount, _minCount);
            }
        }
    }


}
