1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86:
| class aktuelleFarbe : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) { if (PropertyChanged != null) PropertyChanged(this, e); }
private Color _aktVT; public Color aktVT { get { return _aktVT; } set { _aktVT = value; } }
private Color _auswahl; public Color auswahl { get { return _auswahl; } set { _auswahl = value; OnPropertyChanged(new PropertyChangedEventArgs("auswahl")); } } private string _test; public string test { get { return _test; } set { _test = value; OnPropertyChanged(new PropertyChangedEventArgs("test")); } }
public aktuelleFarbe(byte r, byte g, byte b) { aktVT = Color.FromRgb(r, g, b); auswahl = Color.FromRgb(255,0,255); test = "blub";
} }
public partial class MainWindow : Window {
aktuelleFarbe Farbe = new aktuelleFarbe(255,255,0);
public MainWindow() { InitializeComponent(); this.DataContext = Farbe;
} . . . .
private void Rectangle_MouseMove(object sender, MouseEventArgs e) {
SolidColorBrush test = new SolidColorBrush(); Rectangle Rect = (Rectangle)sender; Color Vollton = new Color(); Vollton.R = 255; Vollton.G = 255; Vollton.B = 0; System.Windows.Point position = e.GetPosition(Grid1); Farbe.auswahl = FarbeBerechnen(position.X , position.Y, Vollton, Rect.Width, Rect.Height); test.Color = Color.FromRgb(Farbe.auswahl.R, Farbe.auswahl.G, Farbe.auswahl.B); labelY.Background = test; } |