Advertisement
Guest User

Untitled

a guest
Jul 24th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. public partial class MainWindow : Window
  2. {
  3. public MainWindow()
  4. {
  5. InitializeComponent();
  6. }
  7.  
  8. private void ColorSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
  9. {
  10. Color color = Color.FromRgb((byte)slColorR.Value, (byte)slColorG.Value, (byte)slColorB.Value);
  11. compColor.Background = new SolidColorBrush(color);
  12. }
  13.  
  14. void Click_compColor(object sender, RoutedEventArgs e)
  15. {
  16. savedColor.Background = compColor.Background;
  17. }
  18.  
  19. void Click_savedColor(object sender, RoutedEventArgs e)
  20. {
  21. bool bools = Convert.ToBoolean(savedColor.Background);
  22. byte[] bytes = BitConverter.GetBytes(bools);
  23.  
  24. slColorR.Value = Convert.ToDouble(bytes[0]);
  25. slColorG.Value = Convert.ToDouble(bytes[1]);
  26. slColorB.Value = Convert.ToDouble(bytes[2]);
  27.  
  28. compColor.Background = savedColor.Background;
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement