Advertisement
Guest User

Lama

a guest
May 21st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. public MainWindow()
  2. {
  3. InitializeComponent();
  4. /* DispatcherTimer timer = new DispatcherTimer();
  5. timer.Interval = TimeSpan.FromMilliseconds(500);
  6. timer.Tick += rysuj;
  7. timer.Start();
  8. */ test.SizeChanged += rysuj;
  9. }
  10.  
  11. void rysuj(object sender, EventArgs e)
  12. {
  13. test.Children.Clear();
  14. double wysokosc = test.ActualHeight;
  15. double szerokosc = test.ActualWidth;
  16. double help = 0;
  17. double help2 = 0;
  18. SolidColorBrush redBrush = new SolidColorBrush();
  19. redBrush.Color = Colors.Red;
  20. SolidColorBrush greenBrush = new SolidColorBrush();
  21. greenBrush.Color = Colors.Green;
  22. for (int i = 1; i <= 2; i++)
  23. {
  24.  
  25. Line one = new Line {X1=help,Y1 =0,X2=help,Y2=wysokosc-1,Name='A'+ Convert.ToString(i)};
  26. one.Stroke = redBrush;
  27. one.StrokeThickness = 1;
  28. test.Children.Add(one);
  29. help += szerokosc / 2;
  30. }
  31. for (int i = 1; i <= 2; i++)
  32. {
  33.  
  34. Line one = new Line { X1 = 0, Y1 = help2, X2 = szerokosc-1, Y2 = help2, Name = 'B' + Convert.ToString(i) };
  35. one.Stroke = greenBrush;
  36. one.StrokeThickness = 1;
  37. test.Children.Add(one);
  38. help2 += wysokosc / 2;
  39. }
  40.  
  41.  
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement