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

namespace Exferia_Controles
{
    public partial class Exferia_CheckBox : CheckBox
    {
        #region Propiedades Privadas
        private ToolTip g_tootlTip = new ToolTip();
        #endregion

        #region Propiedades publicas
       
        private string g_str_TootTip = "";
        public string Exferia_CheckBox_ToolTip
        {
            set
            {
                g_str_TootTip = value;
                g_tootlTip.SetToolTip(this, g_str_TootTip);
            }
            get
            {
                return g_str_TootTip;
            }
        }
        internal bool g_bol_Obligatorio = false;
        public bool Exferia_CheckBox_Obligatorio
        {
            set
            {
                g_bol_Obligatorio = value;
                if (g_bol_Obligatorio)
                {
                    BackColor = Colores.G_COLOR_FONDO_OBLIGATORIO;
                }
                else
                {
                    BackColor = Colores.G_COLOR_FONDO_ETIQUETAS;
                }
            }
            get
            {
                return g_bol_Obligatorio;
            }
        }

        bool g_bol_Bloqueable = true;
        public bool Exferia_CheckBox_Bloqueable
        {
            set
            {
                g_bol_Bloqueable = value;
            }
            get
            {
                return g_bol_Bloqueable;
            }
        }
        #endregion

        #region Constructor
        public Exferia_CheckBox()
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.ContainerControl, true);

            Paint += new PaintEventHandler(Exferia_CheckBox_Paint);
        }
        #endregion

        #region Eventos privados

        private void Exferia_CheckBox_Paint(object sender, PaintEventArgs e)
        {
            ForeColor = ForeColor;

            int int_PosicionActual = (Height / 2) - 7;

            /*Pen blackPen = new Pen(ForeColor, 1);
            e.Graphics.FillRectangle(new SolidBrush(BackColor), new Rectangle(0, int_PosicionActual, 14, 14));
            e.Graphics.DrawRectangle(blackPen, 0, int_PosicionActual, 14, 14);*/
            
            if (Checked)
            {
                using (SolidBrush brush = new SolidBrush(Color.Green))
                using (Font wing = new Font("Wingdings 2", 11f)) e.Graphics.DrawString("P", wing, brush, -1, int_PosicionActual + 1);
            }
            else
            {
                using (SolidBrush brush = new SolidBrush(Color.Red))
                using (Font wing = new Font("Wingdings 2", 11f)) e.Graphics.DrawString("", wing, brush, 0, int_PosicionActual);
            }
        }
        #endregion

    }
}
