Beispiel #1
0
        private void Hor_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //получение цвета нажатой ячейки верхней сетки
        {
            Point c = e.GetPosition(Hor);

            try
            {
                TextBlock r = (TextBlock)Hor.InputHitTest(c);
                curColor.Fill = r.Background;
            }
            catch
            {
                Rectangle r = (Rectangle)Hor.InputHitTest(c);
                curColor.Fill = r.Fill;
            }
        }
Beispiel #2
0
        private void Hor_MouseRightButtonDown(object sender, MouseButtonEventArgs e) //установка метки (кружка) на нужную ячейку верхней сетки и ее снятие
        {
            Point p = e.GetPosition(Hor);

            try
            {
                TextBlock r = (TextBlock)Hor.InputHitTest(p);

                Ellipse el = new Ellipse();
                el.Height          = 19;
                el.Width           = 19;
                el.Fill            = Brushes.Transparent;
                el.Stroke          = Brushes.White;
                el.StrokeThickness = 1;
                Canvas.SetLeft(el, Canvas.GetLeft(r));
                Canvas.SetBottom(el, Canvas.GetBottom(r));
                Hor.Children.Add(el);
            }
            catch
            {
                Ellipse el = (Ellipse)Hor.InputHitTest(p);
                Hor.Children.Remove(el);
            }
        }