added some practice examples
This commit is contained in:
53
20241107/WpfApp1/MainWindow.xaml.cs
Normal file
53
20241107/WpfApp1/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user