ProgaOra/20241107/WpfApp1/MainWindow.xaml.cs

53 lines
1.8 KiB
C#
Raw Normal View History

2024-11-07 06:00:00 +00:00
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
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public static int redvalue = 0, greenvalue = 0, bluevalue = 0;
public MainWindow()
{
InitializeComponent();
}
private void redSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> 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<double> 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<double> e)
{
bluevalue = Convert.ToInt32(blueSlider.Value);
SolidColorBrush solidColorBrush = new SolidColorBrush();
solidColorBrush.Color = Color.FromArgb(255, (byte)redvalue, (byte)greenvalue, (byte)bluevalue);
myrectangle.Fill = solidColorBrush;
}
}
}