Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var new_rect = new Rectangle();

            new_rect.Height = inventar.rect_height * Int32.Parse(dolu.Text);
            new_rect.Width  = inventar.rect_width * Int32.Parse(doprava.Text);
            new_rect.Stroke = new SolidColorBrush(Colors.Yellow);
            new_rect.Fill   = new SolidColorBrush(Colors.Black);
            Canvas.SetRight(new_rect, 50);
            Canvas.SetTop(new_rect, 50);

            var boi = new Trojuhelnik(new_rect, true);

            boi.rectic.MouseLeftButtonDown += mysdolu;
            boi.rectic.MouseLeftButtonUp   += mysnahoru;

            canvas.Children.Add(boi.rectic);
        }
Ejemplo n.º 2
0
        public void ShowInventar()
        {
            for (var i = 0; i < rows; i++)
            {
                for (var x = 0; x < columns; x++)
                {
                    Rectangle rect = new Rectangle();
                    rect.Stroke = new SolidColorBrush(Colors.White);
                    rect.Fill   = new SolidColorBrush(Colors.LightGray);
                    rect.Width  = rect_width;
                    rect.Height = rect_height;
                    Canvas.SetLeft(rect, rect_width * x);
                    Canvas.SetTop(rect, rect_height * i);

                    var bis = new Trojuhelnik(rect, false);


                    canvas.Children.Add(bis.rectic);
                }
                //ahoj
            }
        }