C#.NET Program 11

Output:






















Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Question_1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        //for Blue
        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            pictureBox1.BackColor = Color.Blue;
        }

        //for red
        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            pictureBox1.BackColor = Color.Red;
        }

        //for green
        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            pictureBox1.BackColor = Color.Green;
        }

        //To store scrollbar_1 value in label_1
        private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
        {
            label1.Text = hScrollBar1.Value.ToString();
        }

        //To store scrollbar_2 value in label_2
        private void hScrollBar2_Scroll(object sender, ScrollEventArgs e)
        {
            label2.Text = hScrollBar2.Value.ToString();
        }

        //To store scrollbar_3 value in label_3
        private void hScrollBar3_Scroll(object sender, ScrollEventArgs e)
        {
            label3.Text = hScrollBar3.Value.ToString();
        }

        //Change_Button
        private void button1_Click(object sender, EventArgs e)
        {
            pictureBox1.BackColor = Color.FromArgb(hScrollBar1.Value, hScrollBar2.Value, hScrollBar3.Value);
            pictureBox1.BackColor = Color.FromArgb(hScrollBar1.Value, hScrollBar2.Value, hScrollBar3.Value);
            pictureBox1.BackColor = Color.FromArgb(hScrollBar1.Value, hScrollBar2.Value, hScrollBar3.Value);
        }

    }
}











No comments:

Post a Comment