Exemple #1
0
        private void DrawBullet(double x, double y, Canvas c, SceneGeometry sg)
        {
            Ellipse bullet = new Ellipse();

            bullet.Height          = 16;
            bullet.Width           = 16;
            bullet.Fill            = new SolidColorBrush(Color.FromRgb(246, 246, 233));
            bullet.Stroke          = new SolidColorBrush(Color.FromRgb(217, 83, 79));
            bullet.StrokeThickness = 4;
            double imx       = sg.ToDisplayPixel(x);
            double imy       = sg.ToDisplayPixel(y);
            double imy_fixed = sg.OutH - imy;

            bullet.SetValue(Canvas.LeftProperty, imx - 8);
            bullet.SetValue(Canvas.TopProperty, imy_fixed - 8);
            bullet.SetValue(Canvas.ZIndexProperty, 1);
            c.Children.Add(bullet);
        }
Exemple #2
0
        private void DrawLineSegment(double x1, double y1, double x2, double y2, Canvas c, SceneGeometry sg)
        {
            Line l = new Line();

            DrawBullet(x1, y1, c, sg);
            DrawBullet(x2, y2, c, sg);
            x1 = sg.ToDisplayPixel(x1);
            y1 = sg.ToDisplayPixel(y1);
            x2 = sg.ToDisplayPixel(x2);
            y2 = sg.ToDisplayPixel(y2);
            double y1_fixed = sg.OutH - y1;
            double y2_fixed = sg.OutH - y2;

            (l.X1, l.Y1, l.X2, l.Y2) = (x1, y1_fixed, x2, y2_fixed);
            l.SetValue(Canvas.ZIndexProperty, 0);
            l.StrokeThickness = 4;
            l.Stroke          = new SolidColorBrush(Color.FromRgb(51, 51, 51));
            canvasMain.Children.Add(l);
        }