using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WpfApp1 { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public static int redvalue = 0, greenvalue = 0, bluevalue = 0; public MainWindow() { InitializeComponent(); } private void redSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { redvalue = Convert.ToInt32(redSlider.Value); SolidColorBrush solidColorBrush = new SolidColorBrush(); solidColorBrush.Color = Color.FromArgb(255, (byte)redvalue, (byte)greenvalue, (byte)bluevalue); myrectangle.Fill = solidColorBrush; } private void greenSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { greenvalue = Convert.ToInt32(greenSlider.Value); SolidColorBrush solidColorBrush = new SolidColorBrush(); solidColorBrush.Color = Color.FromRgb((byte)redvalue, (byte)greenvalue, (byte)bluevalue); myrectangle.Fill = solidColorBrush; } private void blueSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { bluevalue = Convert.ToInt32(blueSlider.Value); SolidColorBrush solidColorBrush = new SolidColorBrush(); solidColorBrush.Color = Color.FromArgb(255, (byte)redvalue, (byte)greenvalue, (byte)bluevalue); myrectangle.Fill = solidColorBrush; } } }