Eyeshot 11 WinForms API Reference
WinForms Assembly / devDept.Eyeshot Namespace / Viewport Class / DrawBackground Method
The render context
If true, it's drawing the planar reflections (when there are no shaders)
THe intensity of the planar reflections
The color of the parent
The matrix to restrict the rendering to the given rectangle (important for ViewportLayout.RenderToBitmap).
Example

In This Topic
    DrawBackground Method (Viewport)
    In This Topic
    Draws the viewport background.
    Syntax
    'Declaration
     
    Protected Friend Overridable Sub DrawBackground( _
       ByVal context As RenderContextBase, _
       ByVal reflection As Boolean, _
       ByVal reflectionIntensity As Single, _
       ByVal parentColor As Color, _
       ByVal pickMatrix As Transformation _
    ) 
    protected internal virtual void DrawBackground( 
       RenderContextBase context,
       bool reflection,
       float reflectionIntensity,
       Color parentColor,
       Transformation pickMatrix
    )

    Parameters

    context
    The render context
    reflection
    If true, it's drawing the planar reflections (when there are no shaders)
    reflectionIntensity
    THe intensity of the planar reflections
    parentColor
    The color of the parent
    pickMatrix
    The matrix to restrict the rendering to the given rectangle (important for ViewportLayout.RenderToBitmap).
    Example
    The following code fragment demonstrates how to override the DrawBackground() method to draw a custom background.
    class MyViewport : Viewport
    {
          protected override void DrawBackground()
          {
              // Draws standard background
              base.DrawBackground();
     
              // Draws a white rectangle with a margin of 50 pixel from the viewport's border
              gl.Begin(gl.QUADS);
     
              gl.Color3ub(255, 255, 255);
              gl.Vertex2i(50, 50);
              gl.Vertex2i(Width - 50, 50);
              gl.Vertex2i(Width-50, Height -50);
              gl.Vertex2i(50, Height - 50);
              
              gl.End();         
          }
    }
    Class MyViewport
        Inherits Viewport
        Protected Overrides Sub DrawBackground()
            ' Draws standard background
            MyBase.DrawBackground()
     
            ' Draws a white rectangle with a margin of 50 pixel from the viewport's border
            gl.Begin(gl.QUADS)
     
            gl.Color3ub(255, 255, 255)
            gl.Vertex2i(50, 50)
            gl.Vertex2i(Width - 50, 50)
            gl.Vertex2i(Width - 50, Height - 50)
            gl.Vertex2i(50, Height - 50)
     
            gl.[End]()
        End Sub
    End Class
    See Also