SharpDX.DirectWrite.TextLayout.Draw C# (CSharp) Method

Draw() public method

Draws text using the specified client drawing context.
To draw text with this method, a textLayout object needs to be created by the application using SharpDX.DirectWrite.Factory.CreateTextLayout. After the textLayout object is obtained, the application calls the IDWriteTextLayout::Draw method to draw the text, decorations, and inline objects. The actual drawing is done through the callback interface passed in as the textRenderer argument; there, the corresponding DrawGlyphRun API is called.
public Draw ( TextRenderer renderer, float originX, float originY ) : void
renderer TextRenderer Pointer to the set of callback functions used to draw parts of a text string.
originX float The x-coordinate of the layout's left side.
originY float The y-coordinate of the layout's top side.
return void
        public void Draw(TextRenderer renderer, float originX, float originY)
        {
            Draw(null, renderer, originX, originY);
        }

Same methods

TextLayout::Draw ( object clientDrawingContext, TextRenderer renderer, float originX, float originY ) : void

Usage Example

Example #1
0
        protected void DrawHintAndInput()
        {
            if (!Paradigm.Config.Gui.InputBarVisibility)
            {
                return;
            }

            /* Draw Hint */
            if (HintText != null)
            {
                SharedBrush.Color = new Color(ForegroundColor.R, ForegroundColor.G, ForegroundColor.B, 0.7F);
                RenderTarget.DrawText(HintText, InputTextFormat, new RawRectangleF(10, 0, Width - 10, InputBoxHeight / 2),
                                      SharedBrush, D2D1.DrawTextOptions.None);
            }

            /* Draw user input text */
            if (InputTextLayout != null)
            {
                var rect = HintText == null
                    ? new RawRectangleF(10, 5, Width - 10, InputBoxHeight - 5)
                    : new RawRectangleF(10, InputBoxHeight / 2, Width - 10, InputBoxHeight);
                InputTextLayout.MaxWidth  = rect.Right - rect.Left;
                InputTextLayout.MaxHeight = rect.Bottom - rect.Top;
                InputTextLayout.Draw(_customColorRenderer, rect.Left, rect.Top);
            }

            /* Draw Input Box Bottom Line */
            SharedBrush.Color = ForegroundColor;
            RenderTarget.DrawLine(new RawVector2(10, InputBoxHeight + 2), new RawVector2(Width - 10, InputBoxHeight + 2), SharedBrush, 2);
        }
All Usage Examples Of SharpDX.DirectWrite.TextLayout::Draw