當前位置: 首頁>>代碼示例>>C#>>正文


C# DrawingGroup.DrawText方法代碼示例

本文整理匯總了C#中System.Windows.Media.DrawingGroup.DrawText方法的典型用法代碼示例。如果您正苦於以下問題:C# DrawingGroup.DrawText方法的具體用法?C# DrawingGroup.DrawText怎麽用?C# DrawingGroup.DrawText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.DrawingGroup的用法示例。


在下文中一共展示了DrawingGroup.DrawText方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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(-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.DrawText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。