Eyeshot 11 WinForms API Reference
WinForms Assembly / devDept.Eyeshot Namespace / ViewportLayout Class / GetTextOutlinedImage Method
The text
The text font
The text color
The outline color
The rotation and flip to apply to the bitmap
The outline thickness
Example

In This Topic
    GetTextOutlinedImage Method
    In This Topic
    Gets the outlined text image.
    Syntax
    'Declaration
     
    Protected Friend Shared Function GetTextOutlinedImage( _
       ByVal text As String, _
       ByVal font As Font, _
       ByVal color As Color, _
       ByVal outlineColor As Color, _
       ByVal rotateFlip As RotateFlipType, _
       ByVal thickness As Single _
    ) As Bitmap
    protected internal static Bitmap GetTextOutlinedImage( 
       string text,
       Font font,
       Color color,
       Color outlineColor,
       RotateFlipType rotateFlip,
       float thickness
    )

    Parameters

    text
    The text
    font
    The text font
    color
    The text color
    outlineColor
    The outline color
    rotateFlip
    The rotation and flip to apply to the bitmap
    thickness
    The outline thickness

    Return Value

    The text bitmap
    Example
    The following code demonstrates how to efficiently draw an outlined text on screen
    private TextureBase texture1;
    private bool firstTime = false;
    protected override void DrawOverlay(DrawSceneParams data)
    {
        base.DrawOverlay(data);
                
        if (!firstTime)
        {
            firstTime = true;
                
            Font font = new Font("Tahoma", 50, FontStyle.Italic);
                
            Image image1 = GetTextOutlinedImage("My Text", font, Color.Red, Color.Black, RotateFlipType.RotateNoneFlipY, 1);
            texture1 = renderContext.CreateTexture2D(image1, textureFilteringFunctionType.Nearest, textureFilteringFunctionType.Nearest, true, true);        
            image1.Dispose();
            font.Dispose();
        }
                
        DrawTexture(texture1, 100, 100, ContentAlignment.BottomLeft);   
        // Remember to Dispose the texture when it is no more needed, or before quitting the application
    }
    Private texture1 As TextureBase
    Private firstTime As Boolean = False
    Protected Overrides Sub DrawOverlay(data As DrawSceneParams)
    	MyBase.DrawOverlay(data)
                
    	If Not firstTime Then
    		firstTime = True
                
    		Dim font As New Font("Tahoma", 50, FontStyle.Italic)
                
    		Dim image1 As Image = GetTextOutlinedImage("My Text", font, Color.Red, Color.Black, RotateFlipType.RotateNoneFlipY, 1)
    		texture1 = renderContext.CreateTexture2D(image1, textureFilteringFunctionType.Nearest, textureFilteringFunctionType.Nearest, True, True)
            image1.Dispose()
    		font.Dispose()
    	End If
                
    	DrawTexture(texture1, 100, 100, ContentAlignment.BottomLeft)
        ' Remember to Dispose the texture when it is no more needed, or before quitting the application
    End Sub
    See Also