Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public MainWindow()
- {
- InitializeComponent();
- /* DispatcherTimer timer = new DispatcherTimer();
- timer.Interval = TimeSpan.FromMilliseconds(500);
- timer.Tick += rysuj;
- timer.Start();
- */ test.SizeChanged += rysuj;
- }
- void rysuj(object sender, EventArgs e)
- {
- test.Children.Clear();
- double wysokosc = test.ActualHeight;
- double szerokosc = test.ActualWidth;
- double help = 0;
- double help2 = 0;
- SolidColorBrush redBrush = new SolidColorBrush();
- redBrush.Color = Colors.Red;
- SolidColorBrush greenBrush = new SolidColorBrush();
- greenBrush.Color = Colors.Green;
- for (int i = 1; i <= 2; i++)
- {
- Line one = new Line {X1=help,Y1 =0,X2=help,Y2=wysokosc-1,Name='A'+ Convert.ToString(i)};
- one.Stroke = redBrush;
- one.StrokeThickness = 1;
- test.Children.Add(one);
- help += szerokosc / 2;
- }
- for (int i = 1; i <= 2; i++)
- {
- Line one = new Line { X1 = 0, Y1 = help2, X2 = szerokosc-1, Y2 = help2, Name = 'B' + Convert.ToString(i) };
- one.Stroke = greenBrush;
- one.StrokeThickness = 1;
- test.Children.Add(one);
- help2 += wysokosc / 2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement