Eyeshot 11 WinForms API Reference
WinForms Assembly / devDept.Eyeshot Namespace / ViewportLayout Class / DrawImage Method
The image's x corrdinate
The image's y coordinate (from the bottom of the viewport)
The image to draw
Example

In This Topic
    DrawImage Method (ViewportLayout)
    In This Topic
    Draws an image on the ViewportLayout's client area.
    Syntax
    'Declaration
     
    Protected Friend Sub DrawImage( _
       ByVal x As Integer, _
       ByVal y As Integer, _
       ByVal image As Bitmap _
    ) 
    protected internal void DrawImage( 
       int x,
       int y,
       Bitmap image
    )

    Parameters

    x
    The image's x corrdinate
    y
    The image's y coordinate (from the bottom of the viewport)
    image
    The image to draw
    Remarks
    Alpha channel is supported. Use the System.Drawing.Image.RotateFlip(System.Drawing.RotateFlipType) method to flip the image upside down.For better performances create a texture and call DrawTexture (see code below)
    Example
    The following code demonstrates how to efficiently draw an image on screen
    private TextureBase texture1;
    private bool firstTime = false;
    protected override void DrawOverlay(DrawSceneParams data)
    {
        base.DrawOverlay(data);
                
        if (!firstTime)
        {
            firstTime = true;
            texture1 = renderContext.CreateTexture2D(Properties.Resources.Smiley, textureFilteringFunctionType.Nearest, textureFilteringFunctionType.Nearest, true, true);        
            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
    		texture1 = renderContext.CreateTexture2D(Properties.Resources.Smiley, textureFilteringFunctionType.Nearest, textureFilteringFunctionType.Nearest, True, True)
    		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