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;
using System.Windows.Forms;

namespace CDSAE3_Lian_Lian_Kan.Forms
{
    public partial class middle_parent : UserControl
    {
        public middle_parent()
        {
            InitializeComponent();
        }
        private Color _backColor = Etcs.def_Color;
        private Color _frontColor = Etcs.mouse_upper_color;
        public void set_progress(float progress, Color backColor, Color frontColor)
        {
            _backColor = backColor;
            _frontColor = frontColor;
            set_progress(progress);
        }
        public void set_progress(float progress)
        {
            SolidBrush upperBrush = new SolidBrush(_backColor);
            SolidBrush lowerBrush = new SolidBrush(_frontColor);
            Graphics formGraphics = CreateGraphics();
            int wire = (int)((1-progress) * 40);
            formGraphics.FillRectangle(upperBrush, new Rectangle(0, 0, 40, wire));
            formGraphics.FillRectangle(lowerBrush, new Rectangle(0, wire, 40, 40));
            upperBrush.Dispose();
            lowerBrush.Dispose();
            formGraphics.Dispose();
        }
    }
}