public partial class Window1 : Window
{
Brush _orgBtnForegroundBrush;
Brush _orgMainWinBackgroundBrush;
public Window1()
{
InitializeComponent();
_orgBtnForegroundBrush = button1.Foreground;
_orgMainWinBackgroundBrush = mainWin.Background;
}
private void button1_MouseMove(object sender, MouseEventArgs e)
{
if (mainWin.Background != _orgMainWinBackgroundBrush)
{
mainWin.Background = _orgMainWinBackgroundBrush;
}
if (button1.Foreground != Brushes.DarkRed)
{
button1.Foreground = Brushes.DarkRed;
}
}
private void button1_MouseLeave(object sender, MouseEventArgs e)
{
button1.Foreground = _orgBtnForegroundBrush;
mainWin.Background = Brushes.DarkRed;
}
private void mainWin_MouseLeave(object sender, MouseEventArgs e)
{
mainWin.Background = _orgMainWinBackgroundBrush;
}
private void button1_MouseEnter(object sender, MouseEventArgs e)
{
mainWin.Background = _orgMainWinBackgroundBrush;
}
private void mainWin_MouseEnter(object sender, MouseEventArgs e)
{
mainWin.Background = Brushes.DarkRed;
}
}
|