Advertisement
Alisator

hranicko1

May 24th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15.  
  16. namespace WpfApplication1
  17. {
  18.     /// <summary>
  19.     /// Interaction logic for MainWindow.xaml
  20.     /// </summary>
  21.     public partial class MainWindow : Window
  22.     {
  23.         public Label l = new Label();
  24.         public MainWindow()
  25.         {
  26.             InitializeComponent();
  27.             TextBlock_fullText.Foreground = Brushes.White;
  28.             Thickness margin = TextBlock_fullText.Margin;
  29.             margin.Left = 0;
  30.             margin.Top = 0;
  31.             TextBlock_fullText.Margin = margin;
  32.             Rectangle r = new Rectangle();
  33.             r.Width = 200;
  34.             r.Height = 20;
  35.             SolidColorBrush whiteBrush = new SolidColorBrush(Colors.Blue);
  36.             r.Fill = whiteBrush;
  37.  
  38.             l.Width = 100;
  39.             l.Height = 100;
  40.             l.Content = "nic";
  41.             l.Margin = new Thickness(100,100,0,0);
  42.             canv.Children.Add(r);
  43.             canv.Children.Add(l);
  44.         }
  45.  
  46.         protected override void OnKeyDown(KeyEventArgs e)
  47.         {
  48.             if (e.Key == Key.Left)
  49.             {
  50.                 l.Content = "doleva";                
  51.             }
  52.             else if (e.Key == Key.Right)
  53.             {
  54.                 l.Content = "doprava";  
  55.             }
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement