VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging Namespace / VintasoftImage Class / Draw Method / Draw(Graphics,Rectangle,Rectangle) Method
Image should be drawn on this Graphics.
Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.
Rectangle structure that specifies the location and size of the drawn image.
Example



In This Topic
    Draw(Graphics,Rectangle,Rectangle) Method
    In This Topic
    Draws this VintasoftImage on specified graphics.
    Syntax
    'Declaration
     
    Public Overloads Sub Draw( _
       ByVal graphics As Graphics, _
       ByVal destRect As Rectangle, _
       ByVal srcRect As Rectangle _
    ) 
    public void Draw( 
       Graphics graphics,
       Rectangle destRect,
       Rectangle srcRect
    )
    public: void Draw( 
       Graphics* graphics,
       Rectangle destRect,
       Rectangle srcRect
    ) 
    public:
    void Draw( 
       Graphics^ graphics,
       Rectangle destRect,
       Rectangle srcRect
    ) 

    Parameters

    graphics
    Image should be drawn on this Graphics.
    destRect
    Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.
    srcRect
    Rectangle structure that specifies the location and size of the drawn image.
    Example
    This example shows how to overlay two images.
    ' open the original image
    Using originalImage As New Vintasoft.Imaging.VintasoftImage("c:\original-image.tif")
        ' open the overlay image
        Using overlayImage As New Vintasoft.Imaging.VintasoftImage("c:\overlay-image.tif")
            Dim g As System.Drawing.Graphics = originalImage.OpenGraphics()
            ' draw the overlay image on the original image
            overlayImage.Draw(g, New System.Drawing.Rectangle(300, 400, 500, 600), New System.Drawing.Rectangle(1000, 200, 1000, 700))
        End Using
                
        ' close Graphics of the overlay image
        originalImage.CloseGraphics()
                
        ' save original image
        originalImage.Save("c:\processed-image.tif")
    End Using
    // open the original image
    using (Vintasoft.Imaging.VintasoftImage originalImage =
        new Vintasoft.Imaging.VintasoftImage(@"c:\original-image.tif"))
    {
        // open the overlay image
        using (Vintasoft.Imaging.VintasoftImage overlayImage =
            new Vintasoft.Imaging.VintasoftImage(@"c:\overlay-image.tif"))
        {
            System.Drawing.Graphics g = originalImage.OpenGraphics();
            // draw the overlay image on the original image
            overlayImage.Draw(g,
                                new System.Drawing.Rectangle(300, 400, 500, 600),
                                new System.Drawing.Rectangle(1000, 200, 1000, 700));
        }
                
        // close Graphics of the overlay image
        originalImage.CloseGraphics();
                
        // save original image
        originalImage.Save(@"c:\processed-image.tif");
    }
    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also