ImageGear .NET v25.1 - Updated
Zoom
User Guide > How to Work with... > CAD > How To ... > Manipulate View Using a Camera > Zoom

The zoom function in the CADCamera class allows users to zoom and set ViewRect size to the given dimensions.

The CADViewer demo demonstrates this functionality. See Samples.

The following Zoom sample illustrates how you use the zoom function:

C#
Copy Code
using System.IO;
using ImageGear.Formats;
using ImageGear.Formats.CAD;

public static void CameraZoom(string path, double amount)
{
    ImGearCADPage page = null;

    // Load the file.
    using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
    {
        page = (ImGearCADPage)ImGearFileFormats.LoadPage(fileStream);
    }

    // Zoom the camera
    page.Camera.Zoom(amount);
}
VB.NET
Copy Code
Imports System.IO
Imports ImageGear.Formats
Imports ImageGear.Formats.CAD

Public Sub CameraZoom(path As String, amount As Double)
    Dim page As ImGearCADPage

    ' Load the file.
    Using fileStream As New FileStream(path, FileMode.Open, FileAccess.Read)
        page = ImGearFileFormats.LoadPage(fileStream)
    End Using

    ' Zoom the camera
    page.Camera.Zoom(amount)
End Sub

The following ZoomExtents sample illustrates how you use the zoomExtents function to zoom to certain view dimensions:

C#
Copy Code
using System.IO;
using ImageGear.Formats;
using ImageGear.Formats.CAD;

public static void CameraZoomExtents(string path, int width, int height)
{
    ImGearCADPage page = null;

    // Load the file.
    using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
    {
        page = (ImGearCADPage)ImGearFileFormats.LoadPage(fileStream);
    }

    // Zoom the camera
    page.Camera.ZoomExtents(width, height);
}
VB.NET
Copy Code
Imports System.IO
Imports ImageGear.Formats
Imports ImageGear.Formats.CAD

Public Sub CameraZoomExtents(path As String, width As Integer, height As Integer)
    Dim page As ImGearCADPage

    ' Load the file.
    Using fileStream As New FileStream(path, FileMode.Open, FileAccess.Read)
        page = ImGearFileFormats.LoadPage(fileStream)
    End Using

    ' Zoom the camera
    page.Camera.ZoomExtents(width, height)
End Sub