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


C# RenderTarget.DrawText方法代碼示例

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


在下文中一共展示了RenderTarget.DrawText方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Render

 public override void Render(RenderTarget pRender, float pPercent)
 {
     pRender.Transform = Matrix3x2.Identity;
     pRender.DrawText("dx:" + dx + "  dy:" + dy + "  da:" + da, Constants.SmallFont, new RectangleF(0, 0, 200, 50), new SolidColorBrush(pRender, Color4.Black));
     pRender.Transform = Matrix3x2.Rotation(MathUtil.DegreesToRadians(-a + 180)) * Matrix3x2.Translation(x, y);
     pRender.DrawBitmap(ShipBitmap, new RectangleF(-17, -17, 34, 34), 1.0f, BitmapInterpolationMode.Linear);
 }
開發者ID:jonathandlo,項目名稱:deep-space-dive,代碼行數:7,代碼來源:Ship.cs

示例2: Draw

 public void Draw(RenderTarget g)
 {
     g.DrawRectangle(Bounds, Resources.SCBRUSH_RED, 2f);
     foreach(BaseEntity ent in Objects)
     {
         g.DrawText(Level.ToString(), Resources.TEXT_FORMAT, ent.Hitbox, Resources.SCBRUSH_RED);
     }
     for (int i = 0; i < Nodes.Length; i++)
     {
         if (Nodes[i] != null)
         {
             Nodes[i].Draw(g);
         }
     }
 }
開發者ID:Harrum,項目名稱:TestGamePlsIgnore,代碼行數:15,代碼來源:QuadTree.cs

示例3: Render

        internal static async Task Render(CompositionEngine compositionEngine, RenderTarget renderTarget, FrameworkElement rootElement, TextBlock textBlock)
        {
            using (var textFormat = new TextFormat(
                compositionEngine.DWriteFactory,
                textBlock.FontFamily.Source,
                (float)textBlock.FontSize)
            {
                TextAlignment = textBlock.TextAlignment.ToSharpDX(),
                ParagraphAlignment = ParagraphAlignment.Near
            })
            {
                var rect = textBlock.GetBoundingRect(rootElement).ToSharpDX();
                // For some reason we need a bigger rect for the TextBlock rendering to fit in the same boundaries
                rect.Right++;
                rect.Bottom++;

                using (
                    var textBrush = await textBlock.Foreground.ToSharpDX(renderTarget, rect))
                {
                    if (textBrush == null)
                    {
                        return;
                    }

                    var layer = textBlock.CreateAndPushLayerIfNecessary(renderTarget, rootElement);

                    // You can render the bounding rectangle to debug composition
                    //renderTarget.DrawRectangle(
                    //    rect,
                    //    textBrush);
                    renderTarget.DrawText(
                        textBlock.Text,
                        textFormat,
                        rect,
                        textBrush);

                    if (layer != null)
                    {
                        renderTarget.PopLayer();
                        layer.Dispose();
                    }
                    //}
                }
            }
        }
開發者ID:cstehreem,項目名稱:WinRTXamlToolkit,代碼行數:45,代碼來源:TextBlockRenderer.cs

示例4: Render

        internal static async Task Render(CompositionEngine compositionEngine, RenderTarget renderTarget, FrameworkElement rootElement, TextBlock textBlock)
        {
            using (var textFormat = new TextFormat(
                compositionEngine.DWriteFactory,
                textBlock.FontFamily.Source,
                (float)textBlock.FontSize)
            {
                TextAlignment = textBlock.TextAlignment.ToSharpDX(),
                ParagraphAlignment = ParagraphAlignment.Near
            })
            {
                var rect = textBlock.GetBoundingRect(rootElement).ToSharpDX();
                // For some reason we need a bigger rect for the TextBlock rendering to fit in the same boundaries
                rect.Right++;
                rect.Bottom++;

                using (
                    var textBrush = await textBlock.Foreground.ToSharpDX(renderTarget, rect))
                {
                    //using(var layer = new Layer(renderTarget))
                    //{
                    //var layerParameters = new LayerParameters();
                    //layerParameters.ContentBounds = rect;
                    //renderTarget.PushLayer(ref layerParameters, layer);

                    // You can render the bounding rectangle to debug composition
                    //renderTarget.DrawRectangle(
                    //    rect,
                    //    textBrush);
                    renderTarget.DrawText(
                        textBlock.Text,
                        textFormat,
                        rect,
                        textBrush);

                    //renderTarget.PopLayer();
                    //}
                }
            }
        }
開發者ID:prabaprakash,項目名稱:Visual-Studio-2013,代碼行數:40,代碼來源:TextBlockRenderer.cs

示例5: Render

        public void Render(RenderTarget target)
        {
            InitializeGlobalResources(target);

            foreach (var thing in _things)
                thing.Render(target);

            _skeleton.Render(target);

            target.Transform = Matrix3x2.Identity;
            target.DrawText("Player: " + Player, TextFormat, new RectangleF(5, 5, 800, 70), SceneColorBrush);
            target.DrawText("Score: " + Score, TextFormat, new RectangleF(5, 80, 800, 70), SceneColorBrush);

            if (Player != "")
                target.DrawText((60d - (DateTime.Now - PlayerStartTime).TotalSeconds).ToString("00.0"), TextFormat, new RectangleF((float)(Width / 2) - 20, 15, 800, 70), SceneColorBrush);
        }
開發者ID:aL3891,項目名稱:KinectLight,代碼行數:16,代碼來源:MainGame.cs


注:本文中的SharpDX.Direct2D1.RenderTarget.DrawText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。