Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Windows;
- using System.Windows.Input;
- using System.Windows.Media;
- namespace Klassenarbeit_19_06_2018
- {
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- window.Background = Brushes.Yellow;
- }
- private void Rect_MouseEnter(object sender, MouseEventArgs e)
- {
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- rect.Fill = Brushes.IndianRed;
- }
- }
- private void Rect_MouseLeave(object sender, MouseEventArgs e)
- {
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- rect.Fill = Brushes.ForestGreen;
- }
- }
- private void Rect_MouseWheel(object sender, MouseWheelEventArgs e)
- {
- if (rect.IsMouseOver)
- {
- // falls das rechteck zu klein wird
- if (rect.Width + e.Delta < 100 && rect.Height + e.Delta < 100)
- return;
- rect.Width += e.Delta;
- rect.Height += e.Delta;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement