using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using ryControls;
namespace ryControls
{
    /// <summary>
    /// 
    /// </summary>
    public partial class RyWin8Button : System.Windows.Forms.Button
    {
        /// <summary>
        /// 
        /// </summary>
        public RyWin8Button()
            : base()
        {
            base.FlatStyle = FlatStyle.Flat;
            base.FlatAppearance.BorderColor = SkinHelp.ButtonColor;
            FlatAppearance.BorderColor = SkinHelp.ButtonColor;
            base.FlatAppearance.MouseOverBackColor = SkinHelp.ButtonMouseOverColor;
            base.BackColor = SkinHelp.ButtonColor;
            base.ForeColor = SkinHelp.ButtonForeColor;
            base.FlatAppearance.BorderSize = 0;
        }
        /// <summary>
        /// 使用公共皮肤
        /// </summary>
        public bool UseGlobalSkin
        {
            get;
            set;
        }
        /// <summary>
        /// 按钮颜色
        /// </summary>
        public Color ButtonColor
        {
            get {return base.BackColor; }
            set 
            {
                if (SkinHelp.UseGlobalSkin || UseGlobalSkin)
                {
                    base.BackColor = SkinHelp.ButtonColor;
                    base.FlatAppearance.BorderColor = SkinHelp.ButtonColor; 
                }
                else
                {
                    base.BackColor = value;
                    base.FlatAppearance.BorderColor = value; 
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public Color ButtonMouseOverColor
        {
            get { return base.FlatAppearance.MouseOverBackColor; }
            set {
                if (SkinHelp.UseGlobalSkin || UseGlobalSkin)
                {
                    base.FlatAppearance.MouseOverBackColor = SkinHelp.ButtonMouseOverColor;
                }
                else
                {
                    base.FlatAppearance.MouseOverBackColor = value;
                }
            }
        }
        private string _id;
        /// <summary>
        /// 
        /// </summary>
        public string Id
        {
            get { return _id; }
            set { _id = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="text"></param>
        public void SetValue(string id,string text)
        {
            Text = text;
            _id = id;
        }
        /// <summary>
        /// 
        /// </summary>
        protected override bool ShowFocusCues
        {
            get
            {
                // 获得焦点的时候什么都不做
                return false;
            }
        }
    }
}
