当前位置: 首页>>代码示例>>C#>>正文


C# DrawingGroup.DrawLine方法代码示例

本文整理汇总了C#中System.Windows.Media.DrawingGroup.DrawLine方法的典型用法代码示例。如果您正苦于以下问题:C# DrawingGroup.DrawLine方法的具体用法?C# DrawingGroup.DrawLine怎么用?C# DrawingGroup.DrawLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.DrawingGroup的用法示例。


在下文中一共展示了DrawingGroup.DrawLine方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        public ImageSource Draw()
        {
            var drawing = new DrawingGroup();

            //background
            drawing.DrawRectangle(new Rect(-5, -100, 300, 200), Brushes.White, new Pen(Brushes.AntiqueWhite, 1));

            //5 point marker
            drawing.DrawLine(new Point(200, -100), new Point(200, 100), Brushes.BurlyWood);
            drawing.DrawText(201, -7, "5");

            //10 point marker
            drawing.DrawLine(new Point(220, -100), new Point(220, 100), Brushes.BurlyWood);
            drawing.DrawText(221, -7, "10");

            //20 point marker
            drawing.DrawLine(new Point(240, -100), new Point(240, 100), Brushes.BurlyWood);
            drawing.DrawText(241, -7, "20");

            //50 point marker
            drawing.DrawLine(new Point(260, -100), new Point(260, 100), Brushes.BurlyWood);
            drawing.DrawText(261, -7, "50");
            drawing.DrawLine(new Point(280, -100), new Point(280, 100), Brushes.BurlyWood);
            drawing.DrawText(281, -7, "0");

            //disc
            drawing.DrawCircle(new Point(_discXPosition, 0), 3, Brushes.Red);

            return new DrawingImage(drawing);
        }
开发者ID:W0dan,项目名称:physicsExperiments,代码行数:30,代码来源:FrictionExperiment.cs

示例2: Draw

        public ImageSource Draw()
        {
            var drawing = new DrawingGroup();

            //background
            drawing.DrawRectangle(new Rect(-5, -210, 300, 220), Brushes.White, new Pen(Brushes.AntiqueWhite, 1));

            drawing.DrawLine(new Point(-5, 0), new Point(295, 0), Brushes.AntiqueWhite);

            //5 point marker
            drawing.DrawLine(new Point(200, -210), new Point(200, 10), Brushes.BurlyWood);
            drawing.DrawText(201, -107, "5");

            //10 point marker
            drawing.DrawLine(new Point(220, -210), new Point(220, 10), Brushes.BurlyWood);
            drawing.DrawText(221, -107, "10");

            //20 point marker
            drawing.DrawLine(new Point(240, -210), new Point(240, 10), Brushes.BurlyWood);
            drawing.DrawText(241, -107, "20");

            //50 point marker
            drawing.DrawLine(new Point(260, -210), new Point(260, 10), Brushes.BurlyWood);
            drawing.DrawText(261, -107, "50");
            drawing.DrawLine(new Point(280, -210), new Point(280, 10), Brushes.BurlyWood);
            drawing.DrawText(281, -107, "0");

            //disc
            drawing.DrawCircle(_cannonballPosition, 1.5, Brushes.Black);

            var imageDrawing = new ImageDrawing(ResourceProvider.GetImage(Images.Cannon), new Rect(0, -25, 34.0, 24.4));
            drawing.Children.Add(imageDrawing);

            return new DrawingImage(drawing);
        }
开发者ID:W0dan,项目名称:physicsExperiments,代码行数:35,代码来源:KinematicsExperiment.cs

示例3: Draw

        public ImageSource Draw()
        {
            var drawing = new DrawingGroup();

            //background
            drawing.DrawRectangle(new Rect(-100, 0, 200, 200), Brushes.White, new Pen(Brushes.BurlyWood, 1));

            //spring
            drawing.DrawLine(new Point(0, 0), new Point(0, 100 + _ballYPosition), Brushes.Black);

            //disc
            drawing.DrawCircle(new Point(0, 100 + _ballYPosition), 10, Brushes.Red, new Pen(Brushes.DarkRed, 3));

            return new DrawingImage(drawing);
        }
开发者ID:W0dan,项目名称:physicsExperiments,代码行数:15,代码来源:SpringExperiment.cs

示例4: Draw

        public ImageSource Draw()
        {
            var drawing = new DrawingGroup();

            //background
            drawing.DrawRectangle(new Rect(-20, -140, 280, 160), Brushes.AliceBlue, new Pen(Brushes.Blue, 1));

            //horizon
            drawing.DrawLine(new Point(-20, 0), new Point(260, 0),Brushes.Brown);

            //ball
            drawing.DrawCircle(new Point(200, _ballYPosition), 2, Brushes.Orange);

            //other ball
            drawing.DrawCircle(new Point(_boxXPosition + 20, _ballYPosition), 2, Brushes.Green);

            //box
            drawing.DrawRectangle(new Rect(_boxXPosition, -10, 40, 10), Brushes.Red, new Pen(Brushes.DarkRed, 1));

            //text
            drawing.DrawText(-10, -150, string.Format("vertical velocity = {0}", _verticalSpeed.ToString("0.00")));

            return new DrawingImage(drawing);
        }
开发者ID:W0dan,项目名称:physicsExperiments,代码行数:24,代码来源:GravityExperiment.cs


注:本文中的System.Windows.Media.DrawingGroup.DrawLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。