<repo_name>MTKGroup/LookAndFeel<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/LightButton.cs

using LookAndFeel.Components;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Timers;
using System.Threading;


namespace LookAndFeel.Controls
{
    /**
     * 
     */
    public class LightButton : Button
    {
        System.Timers.Timer timer = new System.Timers.Timer();
        private DateTime backupTime;
        System.Threading.Thread thread;
        private double pressedTime = 0;
        private double TotalTime = 700;
        private bool isWorking = false;
        /**
         * 
         */
        public LightButton()
        {
            this.BackColor = Color.White;
            this.ForeColor = Color.FromArgb(150, 40, 27);

            this.Font = new Font("Segoe UI", 8);

        }

        public LightButton(ComponentInfo info)
            : base(info)
        {
            this.BackColor = Color.White;
            this.ForeColor = Color.FromArgb(150, 40, 27);

            this.Font = new Font("Segoe UI", 8);
            SetStyle(System.Windows.Forms.ControlStyles.StandardClick | System.Windows.Forms.ControlStyles.StandardDoubleClick, true);

 

             thread = new System.Threading.Thread(
                                                    () => {
                                                    abc:
                                                        if (!isWorking) goto abc;
                                                        
                                                        var distance = (DateTime.Now - backupTime).TotalMilliseconds;
                                                        if (distance >= 1000 / 60 &&
                                                            MouseButtons != System.Windows.Forms.MouseButtons.None
                                                            && pressedTime < TotalTime)
                                                        {
                                                            pressedTime += distance;
                                                            Invalidate();
                                                            backupTime = DateTime.Now;
                                                            
                                                        }
                                                        else if (pressedTime >= TotalTime)
                                                        {
                                                            isWorking = false;
                                                            this.Invoke((System.Windows.Forms.MethodInvoker)(()=>{
                                                                foreach (var h in clickHandlers)
                                                                {
                                                                    h(this);
                                                                }
                                                            }));

                                                        }

                                                        goto abc;
                                                        
                                                    }, 0);
             thread.Start();
              
        }

        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new LightButton(info);

            //set info for newControl
            //....

            return newControl;

        }



        protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseDown(e);

            backupTime = DateTime.Now;
            pressedTime = 0;
            isWorking = true;

            
        }

        protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseUp(e);
            isWorking = false;
            pressedTime = 0;
            Invalidate();
     
        }



        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            //Draw border
            //Brush b = new SolidBrush(this.BackColor);
            //e.Graphics.DrawRectangle(new Pen(Color.FromArgb(51, 110, 123), 2), 0, 0, this.Width, this.Height);

            try
            {

                base.OnPaintBackground(e);

                Color backColor = BackColor;
                Color foreColor = ForeColor;
                Color borderColor = ForeColor;

                if (isHovered && !isPressed && Enabled)
                {
                    backColor = Color.FromArgb(255,  246,  237);
                }
                else if (isHovered && isPressed && Enabled)
                {
                    //backColor = BackColor;
                }
                else if (Focused)
                {
                    foreColor = Color.FromArgb(
                                        Math.Min((int)(ForeColor.R * 1.4f), 255),
                                        Math.Min((int)(ForeColor.G * 1.4f), 255),
                                        Math.Min((int)(ForeColor.B * 1.4f), 255));
                }

                if (backColor.A == 255 && BackgroundImage == null)
                {
                    e.Graphics.Clear(backColor);
                }

                //Draw percent
                if (MouseButtons != System.Windows.Forms.MouseButtons.None && pressedTime > 0)
                {
                    backColor = Color.FromArgb(255, 246, 237);
                    var percentColor = Color.FromArgb(
                                        (int)(backColor.R * .7f),
                                        (int)(backColor.G * .7f),
                                        (int)(backColor.B * .7f));
                    percentColor = Color.FromArgb(255 , 146,  142);
                    e.Graphics.FillRectangle(new SolidBrush(percentColor), 0, 0,
                                            (float)this.pressedTime / (float)this.TotalTime * (this.Width - 1),
                                            this.Height);
                }
                


                e.Graphics.DrawRectangle(new Pen(borderColor), 0, 0, this.Width - 1, this.Height - 1);

                System.Windows.Forms.TextRenderer.DrawText(e.Graphics,
                        this.Text, this.Font,
                        new Point(this.Width, this.Height / 2),
                        foreColor,
                        Color.Transparent,
                        System.Windows.Forms.TextFormatFlags.HorizontalCenter | System.Windows.Forms.TextFormatFlags.VerticalCenter);
                
            }
            catch
            {
                Invalidate();
            }
        }

        protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e)
        {

        }

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (thread != null && thread.ThreadState == ThreadState.Running)
            {

                thread.Abort();
            }
            
            
        }
    }
}<file_sep>/Source/LookAndFeelFramework/ClientApp/Program.cs
﻿using ClientApp.Properties;
using LookAndFeel.Controls;
using LookAndFeel.Factories;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ClientApp
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static LookAndFeel.Forms.Form form;
        static LookAndFeel.Controls.TextBox textbox1, textbox2;
        static LookAndFeel.Controls.Label labNotification;
        private static LookAndFeel.Controls.CheckBox checkbox;

        [STAThread]
        static void Main()
        { 
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            
            var assembly = AppDomain.CurrentDomain.GetAssemblies().First(a => a.FullName.IndexOf("LookAndFeelLibrary") >= 0);
            var type = assembly.GetTypes().First(t => t.Name.Equals(Settings.Default.Factory));
            var obj = Activator.CreateInstance(type);
            ComponentFactory factory = (ComponentFactory)obj;
            ComponentInfo info;

            //Form
            info = new ComponentInfo(0, 0, 350, 550, "Demo");
            form = (LookAndFeel.Forms.Form)factory.create("Form", info);
            form.FormClosing += (sender, e) =>
                                    {
                                        if (!Settings.Default.Remember) return;
                                        Settings.Default.Username = textbox1.Text;
                                        Settings.Default.Password = <PASSWORD>;
                                        Settings.Default.Save();
                                    };


            //Label username
            info = new ComponentInfo(20, 50, 0, 0, "Username");
            var lab1 = (LookAndFeel.Controls.IControl)factory.create("Label", info);

            //Textbox username
            info = new ComponentInfo(20, 75, 150, 25, "");
            textbox1 = (LookAndFeel.Controls.TextBox)factory.create("TextBox", info);
            

            //Label password
            info = new ComponentInfo(20, 120, 0, 0, "Password");
            var lab2 = (LookAndFeel.Controls.IControl)factory.create("Label", info);

            //Textbox password
            info = new ComponentInfo(20, 145, 150, 25, "");
            textbox2 = (LookAndFeel.Controls.TextBox)factory.create("TextBox", info);


            //Checkbox remember
            info = new ComponentInfo(20, 190, 0, 0, "Remember");
            checkbox = (LookAndFeel.Controls.CheckBox)factory.create("CheckBox", info);
            checkbox.ClickListener += (sender) =>
                                        {
                                            var cbo = sender as LookAndFeel.Controls.CheckBox;
                                            Settings.Default.Remember = cbo.Checked;
                                            Settings.Default.Save();
                                        };

            //Button login
            info = new ComponentInfo(20, 240, 100, 0, "Login");
            var btn = (LookAndFeel.Controls.Button)factory.create("Button", info);
            btn.ClickListener += event_ButtonClick;

            //Label notification
            info = new ComponentInfo(20, 280, 250, 0, "");
            labNotification = (LookAndFeel.Controls.Label)factory.create("Label", info);
           
            
            //Combobox
            info = new ComponentInfo(20, 450, 200, 20, "CboChangeTheme");
            var combobox = (LookAndFeel.Controls.ComboBox)factory.create("ComboBox", info);
            loadComboboxItems(combobox);
            selectDefaultOption(combobox);
            combobox.SelectionChangeCommitted += (sender, e) => 
                                                { 
                                                    var cbo = sender as LookAndFeel.Controls.ComboBox;
                                                    var pair = (KeyValuePair<String, String>)cbo.SelectedItem ;
                                                    if (!pair.Value.Equals(Settings.Default.Factory))
                                                    {
                                                        Settings.Default.Factory = pair.Value;
                                                        Settings.Default.Save();
                                                        form.Close();
                                                        Process.Start(Application.ExecutablePath);
                                                    }
                                                };
            //Group box 
            info = new ComponentInfo(20, 80, 300, 330, "Login");
            var group1 = (LookAndFeel.Controls.GroupBox)factory.create("GroupBox", info);

            group1.addControl(lab1);
            group1.addControl(lab2);
            group1.addControl(labNotification);
            group1.addControl(textbox1);
            group1.addControl(textbox2);
            group1.addControl(btn);
            group1.addControl(checkbox);

            form.addControl(group1);
            form.addControl(combobox);

            form.Text = "Demo";

            //Load textbox
            loadTextboxData();


            //form = (LookAndFeel.Forms.Form)form.convert(new LightComponentFactory());
            //form = (LookAndFeel.Forms.Form)form.convert(new DarkComponentFactory());
            Application.Run(form);

           

        }

        private static void loadTextboxData()
        {
            if (Settings.Default.Remember)
            {
                textbox1.Text = Settings.Default.Username;
                textbox2.Text = Settings.Default.Password;
                checkbox.Checked = true;
            }
        }

        static void combobox_SelectedIndexChanged(object sender, EventArgs e)
        {
            Console.WriteLine("Change");
        }

        private static void selectDefaultOption(LookAndFeel.Controls.ComboBox combobox)
        {
            var pivot = Settings.Default.Factory;
            foreach (var item in combobox.Items)
            {
                var pair = (KeyValuePair<string, string>)item ;
                if (pair.Value.Equals(pivot))
                    combobox.SelectedItem = item;
                
            }
        }

        private static void loadComboboxItems(LookAndFeel.Controls.ComboBox combobox)
        {
            //extract pairs of key/value from Settings
            foreach (var line in Settings.Default.FactoryList)
            {
                string[] pair = line.Split(new char[]{':'});
                KeyValuePair<String, String> p = new KeyValuePair<string,string>(pair[0], pair[1]);
                combobox.Items.Add(p);
                combobox.DisplayMember = "Key";
            }
        }

        private static void event_ButtonClick(object sender)
        {
            if (textbox1.Text.Length == 0 ||
                textbox2.Text.Length == 0)
                labNotification.Text = "Chưa nhập username và password!";
            else
                labNotification.Text = "Hệ thống đang bảo trì!";
        }

        
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/DarkComboBox.cs
﻿using LookAndFeel.Components;
using LookAndFeel.Controls;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LookAndFeel.Controls
{
    public class DarkComboBox : ComboBox
    {
        private ComponentInfo info;

        public DarkComboBox()
        {
        }

        public DarkComboBox(ComponentInfo info) : base(info)
        {
            UseCustomBackColor = true;
            BackColor = Color.FromArgb(228, 241, 254);
            
        }

        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new DarkComboBox(info);


            //set info for newControl
            //....

            return newControl;
        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            foreach (var handler in this.clickHandlers)
            {
                handler(this);
            }
        }


        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            Pen pen = new Pen(this.Parent.ForeColor, 1);

            e.Graphics.DrawRectangle(pen, 0, 0, this.Width-1, this.Height-1);
        }
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/DarkLabel.cs
﻿using LookAndFeel.Components;
using LookAndFeel.Controls;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace LookAndFeel.Controls
{
    public class DarkLabel : Label
    {
        private ComponentInfo info;


        public DarkLabel()
        {
            this.Font = new Font("Segoe UI", 9);

        }

        public DarkLabel(ComponentInfo info) : base(info)
        {
            this.Font = new Font("Segoe UI", 9);

        }

        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new DarkLabel(info);

            //set info for newControl
            //....

            return newControl;
        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            foreach (var handler in this.clickHandlers)
            {
                handler(this);
            }
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            Font font = this.Font;
            // System.Windows.Forms.TextRenderer.MeasureText(this.Text, font);
            e.Graphics.Clear(this.Parent.BackColor);
            e.Graphics.DrawString(this.Text, font, new SolidBrush(Color.FromArgb(189, 195, 199)), 0, 0);

        }
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/LightGroupBox.cs
﻿using LookAndFeel.Components;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LookAndFeel.Controls
{
    public class LightGroupBox : GroupBox
    {
        private ComponentInfo info;

        public LightGroupBox()
        {
        }

        public LightGroupBox(ComponentInfo info)
            : base(info)
        {
            this.Font = new Font("Segoe UI", 11);
        }



        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new LightGroupBox(info);

            //set info for newControl
            //....

            return newControl;
        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            foreach (var handler in this.clickHandlers)
            {
                handler(this);
            }
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            Pen pen = new Pen(ForeColor, 1f);
            int titleHeight = this.Height * 0.2 > 30 ? 30 : (int)(this.Height * 0.2);
            SizeF textSize = e.Graphics.MeasureString(this.Text, this.Font);

            e.Graphics.Clear(BackColor);
            e.Graphics.DrawRectangle(pen, 0, (int)textSize.Height / 2, this.Width - 1 - textSize.Height / 2, this.Height - 1 - textSize.Height / 2);
            //e.Graphics.DrawLine(new Pen(ForeColor), 0, 0, this.Width - 1, 1);
            //e.Graphics.FillRectangle(new SolidBrush(ForeColor), 0, 0, this.Width - 1, titleHeight);

            System.Windows.Forms.TextRenderer.DrawText(e.Graphics, this.Text, this.Font, new Point(2, 0), ForeColor, BackColor);
        }
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Forms/DarkForm.cs

using LookAndFeel.Components;
using LookAndFeel.Factories;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace LookAndFeel.Forms{
    /**
     * 
     */
    public class DarkForm : Form {

        /**
         * 
         */
        public DarkForm() {
            this.backColor = Color.FromArgb(255, 34, 49, 63);
            this.foreColor = Color.FromArgb(189, 195, 199);
            this.lineColor = Color.FromArgb(89, 171, 227);
            
        }

        public DarkForm(ComponentInfo info)
            : base(info)
        {
            this.backColor = Color.FromArgb(255, 34, 49, 63);
            this.foreColor = Color.FromArgb(189, 195, 199);
            this.lineColor = Color.FromArgb(89, 171, 227);
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);


            //cheat window button
            //List<System.Windows.Forms.Button> btns = new List<System.Windows.Forms.Button>();
            
        }     

        /**
         * @return
         */
        public override IComponent clone(ComponentInfo info)
        {
            return new DarkForm(info);
        }

    }
}

<file_sep>/Source/LookAndFeelFramework/ClientApp/FormMain.cs
﻿using LookAndFeel.Controls;
using LookAndFeel.Factories;
using LookAndFeel.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClientApp
{
    public partial class FormMain : DarkForm
    {
        public FormMain()
        {
            InitializeComponent();

            


        }

        private void metroButton1_Click(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Factories/ComponentFactory.cs

using LookAndFeel.Components;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Factories{
    /**
     * 
     */
    public abstract class ComponentFactory {
        protected List<IComponent> samples;

        /**
         * We initalized this.samples in here. So derived class don't have to initalize it anymore.
         */
        public ComponentFactory()
        {
            samples = new List<IComponent>();
        }

        /**
         * Derived class don't have to implement this
         * @param type 
         * @return
         */
        public IComponent create(String type, ComponentInfo info) {
            foreach (var c in samples)
            {
                if (c.getType().ToLower().Equals(type.ToLower()))
                    return c.clone(info);
            }
            return null;
        }



    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Components/ComponentInfo.cs
﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LookAndFeelLibrary.Main.Components
{
    public class ComponentInfo
    {
        public int X;
        public int Y;
        public int Width;
        public int Height;
        public string Name;
        public object Tag;

        public ComponentInfo() { }

        public ComponentInfo(int x, int y, int width, int height) 
        {
            this.X      =   x;
            this.Y      =   y;
            this.Width  =   width;
            this.Height =   height;
        }

        public ComponentInfo(int p1, int p2, int p3, int p4, string p5)
        {
            // TODO: Complete member initialization
            this.X      =   p1;
            this.Y      =   p2;
            this.Width  =   p3;
            this.Height =   p4;
            this.Name   =   p5;
        }

        public Point Pos {
            get {
                return new Point(X, Y);
            }
        }

        public SizeF Size {
            get {
                return new SizeF(Width, Height);
            }
        }

        public ComponentInfo clone()
        {
            return this.MemberwiseClone() as ComponentInfo;
        }
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/Panel.cs

using LookAndFeel.Components;
using LookAndFeel.Factories;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Controls{
    /**
     * 
     */
    public class Panel : MetroFramework.Controls.MetroPanel, IControl {
        protected List<ClickHandler> clickHandlers;
        /**
         * 
         */
        public Panel() {
            this.clickHandlers = new List<ClickHandler>();
        }

        public event ClickHandler ClickListener
        {
            add
            {
                this.clickHandlers.Add(value);
            }
            remove
            {
                this.clickHandlers.Remove(value);
            }
        }

        /**
         * @return
         */
        public IComponent clone(ComponentInfo info)
        {
            // TODO implement here
            return null;
        }

        /**
         * @param f 
         * @return
         */
        public IComponent convert(ComponentFactory f) {
            // TODO implement here
            return null;
        }

        /**
         * @return
         */
        public String getType() {
            return "Panel";
        }

    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/LightLabel.cs
using LookAndFeel.Components;
using LookAndFeel.Controls;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace LookAndFeel.Controls
{
    public class LightLabel : Label, IControl
    {
        public LightLabel()
        {
            this.Font = new Font("Segoe UI", 9);

        }

        public LightLabel(ComponentInfo info) : base(info)
        {
            this.Font = new Font("Segoe UI", 9);
            ForeColor = Color.FromArgb(150, 40, 27);

        }

        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new LightLabel(info);

            //set info for newControl
            //....

            return newControl;
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            Font font = new System.Drawing.Font("Arial", 9);
            e.Graphics.Clear(this.Parent.BackColor);
            e.Graphics.DrawString(this.Text, font, new SolidBrush(ForeColor), 0, 0);


        }
    }
}<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/IContainerControl.cs

using LookAndFeel.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Controls{
    /**
     * 
     */
    public interface IContainerControl : IControl {

        /**
         * @param c
         */
        void addChildren(IComponent c);

        /**
         * @return
         */
        IComponent[] getChildrens();

        /**
         * @param c
         */
        void removeChildren(IComponent c);

    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Components/IComponent.cs

using LookAndFeel.Factories;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Components{
    /**
     * 
     */
    public interface IComponent {

        /**
         * @return
         */
        IComponent clone(ComponentInfo info);

        /**
         * @return
         */
        String getType();

        /**
         * @param f 
         * @return
         */
        IComponent convert(ComponentFactory f);


    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/TextBox.cs

using LookAndFeel.Components;
using LookAndFeel.Factories;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Controls{
    /**
     * 
     */
    public abstract class TextBox : MetroFramework.Controls.MetroTextBox, IControl {
        private const int WM_PAINT = 15;
        private const int OCM_COMMAND = 0x2111;

        protected List<ClickHandler> clickHandlers = new List<ClickHandler>();
        private ComponentInfo info;

        /**
         * 
         */
        public TextBox() {
            this.Width = 100;
        }

        public TextBox(ComponentInfo info)
        {
            this.info = info.clone();
            this.Top = info.Y;
            this.Left = info.X;
            this.Name = this.Text = info.Name;
            this.Width = info.Width != 0 ? info.Width : this.Width;
            this.Height = info.Height != 0 ? info.Height : this.Height;
            info.Width = info.Width != 0 ? info.Width : this.Width;
            info.Height = info.Height != 0 ? info.Height : this.Height;

            this.Width = info.Width = this.Width == 0 ? 100 : this.Width;
        }
        public event ClickHandler ClickListener
        {
            add
            {
                this.clickHandlers.Add(value);
            }
            remove
            {
                this.clickHandlers.Remove(value);
            }
        }

        /**
         * @return
         */
        public String getType() {
            // TODO implement here
            return "TextBox";
        }

        /**
         * @param f 
         * @return
         */
        public IComponent convert(ComponentFactory f) {
            // TODO implement here
            return null;
        }

        /**
         * @return
         */
        public abstract IComponent clone(ComponentInfo info);

        protected override void OnTextChanged(EventArgs e)
        {
            base.OnTextChanged(e);

            Invalidate();
        }
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Forms/Form.cs

using LookAndFeel.Components;
using LookAndFeel.Controls;
using LookAndFeel.Factories;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Forms{
    /**
     * 
     */
    public abstract class Form :  MetroFramework.Forms.MetroForm, IComponent {

        protected ComponentInfo info;
        protected System.Drawing.Color backColor = System.Drawing.Color.White;
        protected System.Drawing.Color foreColor = System.Drawing.Color.Black;
        protected System.Drawing.Color lineColor = System.Drawing.Color.BlueViolet;

        protected Button[] windowButtons = new Button[3];
        /**
         * 
         */
        public Form() {
            
        }

        public Form(ComponentInfo info)
        {
            this.info = info.clone();
            this.Top = info.Y;
            this.Left = info.X;
            this.Name = this.Text = info.Name;
            this.Width = info.Width >= 0 ? info.Width : this.Width;
            this.Height = info.Height >= 0 ? info.Height : this.Height;
            info.Width = info.Width >= 0 ? info.Width : this.Width;
            info.Height = info.Height >= 0 ? info.Height : this.Height;


            AddWindowButtons();
        }

        
        private void AddWindowButtons()
        {
            ComponentInfo info;
            Button btn;


            info = new ComponentInfo(this.Width - 25, 4, 25, 25, "r");
            btn = new WindowButton(info);
            btn.Tag = 25;
            this.Controls.Add(btn); 
            btn.Parent = this;
            btn.Click += btn_Click;
            windowButtons[0] = btn;


            info = new ComponentInfo(this.Width - 50, 4, 25, 25, "0");
            btn = new WindowButton(info);
            btn.Tag = 50;
            this.Controls.Add(btn);
            btn.Parent = this;
            btn.Click += (sender, e) => { this.WindowState = System.Windows.Forms.FormWindowState.Minimized; };

            windowButtons[1] = btn;
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            List<System.Windows.Forms.Control> list = new List<System.Windows.Forms.Control>();


            //Extract default window button
            foreach (System.Windows.Forms.Control item in this.Controls)
	        {
                if (item.GetType().Name.Equals("MetroFormButton"))
                    list.Add(item);
	        } 
            
            //remove
            foreach (var item in list)
            {
                this.Controls.Remove(item);
            }
            this.Font = new System.Drawing.Font("Segoe UI", 8);
            Invalidate();
        }

        protected override void OnResizeEnd(EventArgs e)
        {
            base.OnResizeEnd(e);
            updateWindowButton();
        }

        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);
            updateWindowButton();
        }

        private void updateWindowButton()
        {
            foreach (var b in windowButtons)
            {
                if (b != null)
                {
                    b.Left = this.Width - (int)b.Tag;

                }
            }
        }

        

        void btn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        /**
         * 
         */
        protected HashSet<IControl> controls = new HashSet<IControl>();

        /**
         * @param f 
         * @return
         */
        public IComponent convert(ComponentFactory f) 
        {
            ComponentInfo info = new ComponentInfo();
            var newForm = (Form)f.create(this.getType(), info);

            foreach (var c in this.controls)
            {
                newForm.addControl((IControl)c.convert(f));
            }

            return newForm;
        }

        public void addControl(IControl component)
        {
            //((System.Windows.Forms.Control)component).Parent = this;
            this.controls.Add(component);
            this.Controls.Add((System.Windows.Forms.Control)component);
        }

        public void removeControl(IControl component)
        {
            this.controls.Remove(component);
            this.Controls.Remove((System.Windows.Forms.Control)component);
           
        }

        /**
         * @return
         */
        public String getType()
        {
            // TODO implement here
            return "Form";
        }


        public abstract IComponent clone(ComponentInfo info);

        public override System.Drawing.Color BackColor
        {
            get
            {
                return this.backColor;
            }

            set
            {
                this.backColor = value;
            }
        }

        public override System.Drawing.Color ForeColor
        {
            get
            {
                return this.foreColor;
            }
            set
            {
                this.foreColor = value;
            }
        }

        protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaintBackground(e);


        }
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            e.Graphics.Clear(this.BackColor);
            e.Graphics.FillRectangle(new System.Drawing.SolidBrush(this.lineColor),
                        0, 0, this.Width, 4);
            var font = new System.Drawing.Font(this.Font.FontFamily, 12);
            e.Graphics.DrawString(this.Text,
                                font,
                                new System.Drawing.SolidBrush(this.foreColor),
                                20, 20);
        }

        /**
         * Nested class WindowButton
        **/
        private class WindowButton : Button
        {
            public WindowButton(ComponentInfo info) : base(info)
            {
 
            }

            protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
            {
                base.OnPaint(e);

                var backColor = this.Parent.BackColor;
                var foreColor = this.Parent.ForeColor;

                if (isHovered)
                {
                    backColor = System.Drawing.Color.FromArgb(
                                            (int)(backColor.R * 0.8f),
                                            (int)(backColor.G * 0.8f),
                                            (int)(backColor.B * 0.8f));
                }


                e.Graphics.Clear(backColor);
                var font = new System.Drawing.Font("Webdings", 9.25f);
                System.Windows.Forms.TextRenderer.DrawText(
                                    e.Graphics, 
                                    Text,
                                    font, 
                                    ClientRectangle,
                                    foreColor,
                                    backColor, 
                                    System.Windows.Forms.TextFormatFlags.HorizontalCenter | System.Windows.Forms.TextFormatFlags.VerticalCenter | System.Windows.Forms.TextFormatFlags.EndEllipsis);
            }

            public override IComponent clone(ComponentInfo info)
            {
                return new WindowButton(info);
            }
        }
    }
}<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/DarkGroupBox.cs
﻿using LookAndFeel.Components;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LookAndFeel.Controls
{
    public class DarkGroupBox : GroupBox
    {
        private ComponentInfo info;

        public DarkGroupBox(){
        }

        public DarkGroupBox(ComponentInfo info) : base(info)
        {
            this.Font = new Font("Segoe UI", 11);
        }

        

        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new DarkGroupBox(info);

            //set info for newControl
            //....

            return newControl;
        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            foreach (var handler in this.clickHandlers)
            {
                handler(this);
            }
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            Pen pen = new Pen(ForeColor, .5f);
            int titleHeight = this.Height * 0.2 > 30 ?  30 : (int)(this.Height * 0.2);
            e.Graphics.Clear(BackColor);

            e.Graphics.DrawRectangle(pen, 0, 0, this.Width-1, this.Height-1);
            e.Graphics.FillRectangle(new SolidBrush(ForeColor), 0, 0, this.Width - 1, titleHeight);

            SizeF textSize = e.Graphics.MeasureString(this.Text, this.Font);
            System.Windows.Forms.TextRenderer.DrawText(e.Graphics, this.Text, this.Font, new Point(2, titleHeight/2 - (int)textSize.Height/2), BackColor);
        }
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/LightTextBox.cs
using LookAndFeel.Components;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LookAndFeel.Controls
{
    public class LightTextBox : TextBox
    {
        private bool focused;

        public LightTextBox()
        {


        }

        public LightTextBox(ComponentInfo info)
            : base(info)
        {
            BackColor = Color.FromArgb(255,  246,  237);
            FontSize = MetroFramework.MetroTextBoxSize.Medium;
            UseCustomBackColor = true;
            UseCustomForeColor = true;
            Style = MetroFramework.MetroColorStyle.Black;

            

        }

        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new LightTextBox(info);


            //set info for newControl
            //....

            return newControl;
        }


        protected override void OnEnter(EventArgs e)
        {
            base.OnEnter(e);

            this.focused = true;
            Invalidate();
        }

        protected override void OnLeave(EventArgs e)
        {
            base.OnLeave(e);

            this.focused = false;
            Invalidate();
        }

        
     
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            foreach (var handler in this.clickHandlers)
            {
                handler(this);
            }

            
        }

        

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);
            int lineWidth = 1;

            if (focused)
            {
                lineWidth = 2;
            }

            Pen pen = new Pen(this.Parent.ForeColor, lineWidth);
            Pen clearPen = new Pen(this.Parent.BackColor);

            

            e.Graphics.DrawRectangle(clearPen, 
                                0, 
                                0, 
                                this.Width - 1, 
                                this.Height - 1);
             
            e.Graphics.DrawLine(pen, 0, this.Height - 1, this.Width, this.Height - 1);
            e.Graphics.DrawLine(pen, 0, this.Height - 1, 0, this.Height * .7f);
            e.Graphics.DrawLine(pen, this.Width - 1, this.Height - 1, this.Width - 1, this.Height * .7f);
        }


        protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaintBackground(e);

        }

        protected override void OnGotFocus(EventArgs e)
        {
            base.OnGotFocus(e);
            //this.ForeColor = Color.DarkGray;
        }

        protected override void OnForeColorChanged(EventArgs e)
        {
            base.OnForeColorChanged(e);

        }


    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/DarkTextBox.cs
﻿using LookAndFeel.Components;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LookAndFeel.Controls
{
    public class DarkTextBox : TextBox
    {

        public DarkTextBox()
        {


        }

        public DarkTextBox(ComponentInfo info) : base(info)
        {
            BackColor = Color.FromArgb(228, 241, 254); 
            ForeColor = Color.Red;
            FontSize = MetroFramework.MetroTextBoxSize.Medium;
            UseCustomBackColor = true;
            UseCustomForeColor = true;
            Style = MetroFramework.MetroColorStyle.White;
            this.ForeColor = Color.FromArgb(34, 49, 63);
        }

        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new DarkTextBox(info);


            //set info for newControl
            //....

            return newControl;
        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            foreach (var handler in this.clickHandlers)
            {
                handler(this);
            }
        }


        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);


        }


        protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaintBackground(e);
            
        }

        protected override void OnGotFocus(EventArgs e)
        {
            base.OnGotFocus(e);
            //this.ForeColor = Color.DarkGray;
        }

        protected override void OnForeColorChanged(EventArgs e)
        {
            base.OnForeColorChanged(e);  

        }

       
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/DarkButton.cs

using LookAndFeel.Components;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace LookAndFeel.Controls
{
    /**
     * 
     */
    public class DarkButton : Button
    {
        /**
         * 
         */
        public DarkButton()
        {
            this.BackColor = Color.FromArgb(34, 49, 63);
            this.ForeColor = Color.FromArgb(189, 195, 199);

            this.Font = new Font("Segoe UI", 8);
            
        }

        public DarkButton(ComponentInfo info) : base(info)
        {
            this.BackColor = Color.FromArgb(34, 49, 63);
            this.ForeColor = Color.FromArgb(189, 195, 199);

            this.Font = new Font("Segoe UI", 8);
        }

        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new DarkButton(info);

            //set info for newControl
            //....

            return newControl;

        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            foreach (var handler in this.clickHandlers)
            {
                handler(this);
            }
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            //Draw border
            //Brush b = new SolidBrush(this.BackColor);
            //e.Graphics.DrawRectangle(new Pen(Color.FromArgb(51, 110, 123), 2), 0, 0, this.Width, this.Height);

            try
            {

                base.OnPaintBackground(e);

                Color backColor = BackColor;
                Color foreColor = ForeColor;
                Color borderColor =  Color.FromArgb(
                                        Math.Min((int)(foreColor.R * .7f), 255),
                                        Math.Min((int)(foreColor.G * .7f), 255),
                                        Math.Min((int)(foreColor.B * .7f), 255));

                if (isHovered && !isPressed && Enabled)
                {
                    backColor = Color.FromArgb(
                                        (int)(BackColor.R * 0.5f),
                                        (int)(BackColor.G * 0.5f),
                                        (int)(BackColor.B * 0.5f)
                                    );
                }
                else if (isHovered && isPressed && Enabled)
                {
                    //backColor = Color.FromArgb(44, 62, 80);
                    //foreColor = Color.FromArgb(239, 245, 249);
                }
                else if (Focused)
                {
                    foreColor = Color.White;
                }

                if (backColor.A == 255 && BackgroundImage == null)
                {
                    e.Graphics.Clear(backColor);
                }

                e.Graphics.DrawRectangle(new Pen(borderColor), 0, 0, this.Width - 1, this.Height - 1);

                System.Windows.Forms.TextRenderer.DrawText(e.Graphics,
                        this.Text, this.Font,
                        new Point(this.Width, this.Height/2),
                        foreColor,
                        Color.Transparent, 
                        System.Windows.Forms.TextFormatFlags.HorizontalCenter | System.Windows.Forms.TextFormatFlags.VerticalCenter);

            }
            catch
            {
                Invalidate();
            }
        }

        protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e)
        {

        }
    }
}<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/GroupBox.cs

using LookAndFeel.Components;
using LookAndFeel.Factories;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Controls{
    /**
     * 
     */
    public abstract class GroupBox : System.Windows.Forms.GroupBox , IControl {
        protected HashSet<IControl> controls = new HashSet<IControl>();
        protected List<ClickHandler> clickHandlers = new List<ClickHandler>();
        protected ComponentInfo info;
        /**
         * 
         */
        public GroupBox() {
        }

        public GroupBox(ComponentInfo info)
        {
            this.info = info.clone();
            this.Top = info.Y;
            this.Left = info.X;
            this.Name = this.Text = info.Name;
            this.Width = info.Width != 0 ? info.Width : this.Width;
            this.Height = info.Height != 0 ? info.Height : this.Height;
            info.Width = info.Width != 0 ? info.Width : this.Width;
            info.Height = info.Height != 0 ? info.Height : this.Height;

            this.ParentChanged += (sender, e) => {
                                        var parent =  ((GroupBox)sender).Parent;
                                        if (parent != null) 
                                        {
                                            BackColor = parent.BackColor;
                                            ForeColor = parent.ForeColor;
                                        }
                                    };
        }


        

        public event ClickHandler ClickListener
        {
            add
            {
                this.clickHandlers.Add(value);
            }
            remove
            {
                this.clickHandlers.Remove(value);
            }
        }

        /**
         * @param f 
         * @return
         */
        public IComponent convert(ComponentFactory f) {
            // TODO implement here
            return null;
        }

        /**
         * @return
         */
        public abstract IComponent clone(ComponentInfo info);

        /**
         * @return
         */
        public String getType() {
            return "GroupBox";
        }

        public void addControl(IControl component)
        {
            this.controls.Add(component);
            this.Controls.Add((System.Windows.Forms.Control)component);
        }

        

    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/Button.cs

using LookAndFeel.Components;
using LookAndFeel.Factories;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Controls{
    /**
     * 
     */
    public abstract class Button : MetroFramework.Controls.MetroButton, IControl {
        protected bool isHovered;
        protected bool isPressed;
        protected List<ClickHandler> clickHandlers = new List<ClickHandler>();
        protected ComponentInfo info;

        /**
         * 
         */
        public Button() {
            info = new ComponentInfo();
        }

        public Button(ComponentInfo info)
        {
            // TODO: Complete member initialization
            this.info   = info.clone();
            this.Top    = info.Y;
            this.Left   = info.X;         
            this.Name   = this.Text = info.Name;
            this.Width  = info.Width    != 0 ? info.Width   : this.Width;
            this.Height = info.Height   != 0 ? info.Height  : this.Height;
            info.Width  = info.Width    != 0 ? info.Width   : this.Width;
            info.Height = info.Height   != 0 ? info.Height  : this.Height;


        }

        /**
         * @return
         */
        public String getType() {
            return "Button";
        }

        /**
         * @return
         */
        public abstract IComponent clone(ComponentInfo info);

        /**
         * @param f 
         * @return
         */
        public IComponent convert(ComponentFactory f) {
            return f.create(this.getType(), this.info);    
        }

        public event ClickHandler ClickListener 
        { 
            add{
                this.clickHandlers.Add(value);
            }
            remove {
                this.clickHandlers.Remove(value);
            }
        }

        

        protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseDown(e);
            isPressed = true;
        }

        protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
        {
            base.OnMouseUp(e);
            isPressed = false;
            Invalidate();
        }

        protected override void OnMouseEnter(EventArgs e)
        {
            base.OnMouseEnter(e);
            isHovered = true;
        }

        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);
            isHovered = false;
        }

        public override string Text
        {
            get
            {
                return base.Text;
            }
            set
            {
                this.Name = value;
                base.Text = value;
            }
        }


    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Factories/DarkComponentFactory.cs

using LookAndFeel.Controls;
using LookAndFeel.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Factories{
    /**
     * 
     */
    public class DarkComponentFactory : ComponentFactory {


        /**
         * You need add component  samples  in here
         */
        public DarkComponentFactory() {
            this.samples.Add(new DarkButton());
            this.samples.Add(new DarkForm());
            this.samples.Add(new DarkLabel());
            this.samples.Add(new DarkCheckBox());
            this.samples.Add(new DarkComboBox());
            this.samples.Add(new DarkTextBox());
            this.samples.Add(new DarkGroupBox());

        }

    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/LightComboBox.cs
using LookAndFeel.Components;
using LookAndFeel.Controls;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LookAndFeel.Controls
{
    public class LightComboBox : ComboBox
    {
        private ComponentInfo info;

        public LightComboBox()
        {
            UseCustomBackColor = true;
            BackColor = Color.FromArgb(241, 169, 160);
        }

        public LightComboBox(ComponentInfo info)
            : base(info)
        {
            UseCustomBackColor = true;
            BackColor = Color.FromArgb(255,  246,  237);
        }

        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new LightComboBox(info);


            //set info for newControl
            //....

            return newControl;
        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            foreach (var handler in this.clickHandlers)
            {
                handler(this);
            }
        }


        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            Pen pen = new Pen(this.Parent.ForeColor, 1);

            e.Graphics.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);
        }
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Forms/LightForm.cs

using LookAndFeel.Components;
using LookAndFeel.Factories;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace LookAndFeel.Forms{
    /**
     * 
     */
    public class LightForm : Form {

        /**
         * 
         */
        public LightForm() {
            this.backColor = Color.FromArgb(34, 49, 63);
            this.foreColor = Color.FromArgb(189, 195, 199);
            this.lineColor = Color.FromArgb(89, 171, 227);
        }

        public LightForm(ComponentInfo info) : base(info)
        {
            this.backColor = Color.White;
            this.foreColor = Color.FromArgb(150, 40, 27);
            this.lineColor = Color.FromArgb(217, 30, 24);
        }
        /**
         * @return
         */
        public override IComponent clone(ComponentInfo info)
        {
            return new LightForm(info);
        }

    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Factories/LightComponentFactory.cs

using LookAndFeel.Controls;
using LookAndFeel.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Factories{
    /**
     * 
     */
    public class LightComponentFactory : ComponentFactory {

 
        /**
         * You need add component  samples  in here
         */
        public LightComponentFactory() {
            this.samples.Add(new LightButton());
            this.samples.Add(new LightForm());
            this.samples.Add(new LightLabel());
            this.samples.Add(new LightCheckBox());
            this.samples.Add(new LightComboBox());
            this.samples.Add(new LightTextBox());
            this.samples.Add(new LightGroupBox());
        }

    }
}<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/LightCheckBox.cs
using LookAndFeel.Components;
using LookAndFeel.Controls;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LookAndFeel.Controls
{
    public class LightCheckBox : CheckBox
    {
        private ComponentInfo info;


        public LightCheckBox()
        {
            this.Font = new Font("Segoe UI", 8);

        }

        public LightCheckBox(ComponentInfo info)
            : base(info)
        {
            this.Font = new Font("Segoe UI", 8);

        }

        public override IComponent clone(ComponentInfo info)
        {
            var newControl = new LightCheckBox(info);

            //set info for newControl
            //....

            return newControl;
        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            foreach (var handler in this.clickHandlers)
            {
                handler(this);
            }
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);
            Color foreColor = this.Parent.ForeColor;
            Color backColor;

            if (isHovered)
                foreColor = Color.FromArgb(
                            Math.Min((int)(foreColor.R * 1.3f), 255),
                            Math.Min((int)(foreColor.G * 1.3f), 255),
                            Math.Min((int)(foreColor.B * 1.3f), 255));

            backColor = Color.FromArgb(
                                    (int)(foreColor.R * .7f),
                                    (int)(foreColor.G * .7f),
                                    (int)(foreColor.B * .7f));

            SizeF textSize = e.Graphics.MeasureString(this.Text, this.Font);
            e.Graphics.Clear(this.Parent.BackColor);
            System.Windows.Forms.TextRenderer.DrawText(e.Graphics, this.Text, this.Font, new Point(14, (int)(this.Height / 2 - textSize.Height / 2)), foreColor);

            e.Graphics.DrawRectangle(new Pen(backColor), 0, this.Height / 4 - 1, this.Height / 2, this.Height / 2);
            if (this.Checked)
            {
                e.Graphics.FillRectangle(new SolidBrush(backColor),
                                            (int)(this.Height / 4 * 0.4),
                                            (int)(this.Height / 4 * 1.4 - 1),
                                            (int)(this.Height / 2 * 0.8),
                                            (int)(this.Height / 2 * 0.8));
            }




        }
    }
}
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/IControl.cs

using LookAndFeel.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LookAndFeel.Controls{
    /**
     * 
     */
    public delegate void ClickHandler(object sender);
    public interface IControl : IComponent {


        event ClickHandler ClickListener;

    }
}
<file_sep>/README.md
# LookAndFeel
Thiết kế và phát triển dự án LookAndFeel
<file_sep>/Source/LookAndFeelFramework/LookAndFeelLibrary/Main/Controls/ComboBox.cs
﻿using LookAndFeel.Components;
using LookAndFeel.Controls;
using LookAndFeel.Factories;
using LookAndFeelLibrary.Main.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LookAndFeel.Controls
{
    public abstract class ComboBox : MetroFramework.Controls.MetroComboBox, IControl
    {
        protected List<ClickHandler> clickHandlers = new List<ClickHandler>();
        protected ComponentInfo info;

        public ComboBox()
        {
        }

        public ComboBox(ComponentInfo info)
        {
            this.info = info.clone();
            this.Top = info.Y;
            this.Left = info.X;
            this.Name = this.Text = info.Name;
            this.Width = info.Width != 0 ? info.Width : this.Width;
            this.Height = info.Height != 0 ? info.Height : this.Height;
            info.Width = info.Width != 0 ? info.Width : this.Width;
            info.Height = info.Height != 0 ? info.Height : this.Height;
        }

        public event ClickHandler ClickListener
        {
            add
            {
                this.clickHandlers.Add(value);
            }
            remove
            {
                this.clickHandlers.Remove(value);
            }

        }

        /**
         * @return
         */
        public String getType() {
            return "ComboBox";
        }

        /**
         * @return
         */
        public abstract IComponent clone(ComponentInfo info);

        /**
         * @param f 
         * @return
         */
        public IComponent convert(ComponentFactory f) {
            var info = new ComponentInfo();
            return f.create(this.getType(), info);    
        }
    }
}
