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 WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
        }

        private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
        {
            Data.red = hScrollBar1.Value;
            panel1.BackColor = Color.FromArgb(Data.red, Data.green, Data.blue);
            textBox1.Text = Data.red.ToString();
        }
        private void hScrollBar2_Scroll(object sender, ScrollEventArgs e)
        {
            Data.green = hScrollBar2.Value;
            panel1.BackColor = Color.FromArgb(Data.red, Data.green, Data.blue);
            textBox2.Text = Data.green.ToString();
        }

        private void hScrollBar3_Scroll(object sender, ScrollEventArgs e)
        {
            Data.blue = hScrollBar3.Value;
            panel1.BackColor = Color.FromArgb(Data.red, Data.green, Data.blue);
            textBox3.Text = Data.blue.ToString();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                Data.red = int.Parse(textBox1.Text);
            }
            
            panel1.BackColor = Color.FromArgb(Data.red, Data.green, Data.blue);
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            if (textBox2.Text != "")
            {
                Data.green = int.Parse(textBox2.Text);
            }
            
            panel1.BackColor = Color.FromArgb(Data.red, Data.green, Data.blue);
        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            if (textBox3.Text != "")
            {
                Data.blue = int.Parse(textBox3.Text);
            }
            
            panel1.BackColor = Color.FromArgb(Data.red, Data.green, Data.blue);
        }
    }

    public static class Data
    {
        public static int red = 0;
        public static int green = 0;
        public static int blue = 0;
    }
}
