namespace _2024._03._18
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void RScrollBar_Scroll(object sender, ScrollEventArgs e)
        {
            panel1.BackColor = Color.FromArgb(RScrollBar.Value, GScrollBar.Value, BScrollBar.Value);
            RTextBox.Text = RScrollBar.Value.ToString();
        }

        private void GScrollBar_Scroll(object sender, ScrollEventArgs e)
        {
            panel1.BackColor = Color.FromArgb(RScrollBar.Value, GScrollBar.Value, BScrollBar.Value);
            GTextBox.Text = GScrollBar.Value.ToString();
        }

        private void BScrollBar_Scroll(object sender, ScrollEventArgs e)
        {
            panel1.BackColor = Color.FromArgb(RScrollBar.Value, GScrollBar.Value, BScrollBar.Value);
            BTextBox.Text = BScrollBar.Value.ToString();
        }

        private void RTextBox_TextChanged(object sender, EventArgs e)
        {
            if (RTextBox.Text == "-") RTextBox.Text = "0";
            if (int.Parse(RTextBox.Text) > 255) RTextBox.Text = "255";
            RScrollBar.Value = int.Parse(RTextBox.Text);
            panel1.BackColor = Color.FromArgb(RScrollBar.Value, GScrollBar.Value, BScrollBar.Value);
        }

        private void GTextBox_TextChanged(object sender, EventArgs e)
        {
            if (GTextBox.Text == "-") GTextBox.Text = "0";
            if (int.Parse(GTextBox.Text) > 255) GTextBox.Text = "255";
            GScrollBar.Value = int.Parse(GTextBox.Text);
            panel1.BackColor = Color.FromArgb(RScrollBar.Value, GScrollBar.Value, BScrollBar.Value);
        }

        private void BTextBox_TextChanged(object sender, EventArgs e)
        {
            if (BTextBox.Text == "-") BTextBox.Text = "0";
            if (int.Parse(BTextBox.Text) > 255) BTextBox.Text = "255";
            BScrollBar.Value = int.Parse(BTextBox.Text);
            panel1.BackColor = Color.FromArgb(RScrollBar.Value, GScrollBar.Value, BScrollBar.Value);
        }
    }
}