Eyeshot 11 Documentation
WinForms Control / Quick Start
In This Topic
    Quick Start
    In This Topic

    This topic will give you a head start on creating great looking viewport for all of your Windows Forms applications.

     Creating a new Windows Application Project
    1. Launch Visual Studio
    2. From the File menu, select New, and then click Project
    3. In the New Project dialog box, click either Visual C# or Visual Basic from the Project types list
    4. From the Templates list, click Windows Forms Application
    5. In the Name field, replace the default project name with the name of your project
     Adding the control to your Form

    Add the control to your Windows Form by either double-clicking on the ViewportLayout toolbox icon (installed in the 'Eyeshot Ultimate 11' tab of the Visual Studio toolbox), or by clicking on the icon once then "drawing" the control onto the form using the left mouse button.

    The Eyeshot viewport control in design-time mode

    Figure 1: The ViewportLayout control in design-time mode.

     Required using/Imports statements

    Add the following using/Imports statements at the beginning of the Form1.cs file.

    using devDept.Eyeshot;
    using devDept.Eyeshot.Entities;
    using devDept.Geometry;
    Imports devDept.Eyeshot
    Imports devDept.Eyeshot.Entities
    Imports devDept.Geometry
     Customizing the Viewport

    Select the Customize ViewportLayout control item from the control Smart Tag menu to open the Visual Control Designer window.

    Right-click the CoordinateSystem tree node to open the Element Designer window.

    Set Lighting property to true, change the Z arrow color and confirm.

     Drawing a box

    Add the following OnLoad() override, then build and start your application.

    protected override void OnLoad(EventArgs e)
    {
       // Creates a mesh with the shape of a box
       Mesh m = Mesh.CreateBox(30, 20, 10);
    
       // Adds the mesh to the master entity collection
       viewportLayout1.Entities.Add(m, Color.DarkRed);
    
       // Fits the drawing in the viewport
       viewportLayout1.ZoomFit();
    
       base.OnLoad(e);
    }
    Protected Overrides Sub OnLoad(e As EventArgs)
       ' Creates a mesh with the shape of a box
       Dim m As Mesh = Mesh.CreateBox(30, 20, 10)
    
       ' Adds the mesh to the master entity collection
       ViewportLayout1.Entities.Add(m, Color.DarkRed)
    
       ' Fits the drawing in the viewport
       ViewportLayout1.ZoomFit()
    
       MyBase.OnLoad(e)
    End Sub

    You should now see something like this:

    Your first 3D drawing with Eyeshot

    Figure 2: Your first 3D drawing with Eyeshot.

    Navigation quick commands:

    • Middle mouse button combined with Ctrl or Shift keys to Zoom/Pan/Rotate
    • Mouse wheel to Zoom
    • Ctrl+F to fit the model in the viewport
     Now it's your turn

    Try adding more entities like lines, circles, etc. You'll find them in the devDept.Eyeshot.Entities namespace.

    See Also