Here is a complete control:
using System;
using System.Drawing;
using System.Windows.Forms;
using Autodesk.AutoCAD;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.GraphicsSystem;
using Application = Autodesk.AutoCAD.ApplicationServices.Application;
using View = Autodesk.AutoCAD.GraphicsSystem.View;
namespace TestCS
{
public partial class PreviewUserControl : UserControl
{
#region Fields
Device device;
Extents3d extents;
Model model;
Solid3d solid;
Point start;
View view;
#endregion
#region Constructors
public PreviewUserControl()
{
InitializeComponent();
SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
}
#endregion
#region Methods
void CleanUp()
{
if (solid != null)
{
solid.Dispose();
solid = null;
}
if (model != null)
{
model.Dispose();
model = null;
}
if (view != null)
{
// View need to be removed from device
device?.EraseAll();
view.Dispose();
view = null;
}
if (device != null)
{
device.Dispose();
device = null;
}
}
protected override void CreateHandle()
{
base.CreateHandle();
if (DesignMode) return;
Document doc = Application.DocumentManager.MdiActiveDocument;
Manager gsm = doc.GraphicsManager;
var descriptor = new KernelDescriptor();
descriptor.addRequirement(UniqueString.Intern("3D Drawing"));
GraphicsKernel kernel = Manager.AcquireGraphicsKernel(descriptor);
device = gsm.CreateAutoCADDevice(kernel, Handle);
device.OnSize(Size);
view = new View();
view.SetView(new Point3d(1, 1, 1), view.Target, view.UpVector, view.FieldWidth, view.FieldHeight);
device.Add(view);
model = gsm.CreateAutoCADModel(kernel);
extents = new Extents3d();
solid = new Solid3d();
solid.CreateBox(1, 1, 1);
solid.ColorIndex = 1;
view.Add(solid, model);
if (solid.Bounds != null) extents.AddExtents(solid.Bounds.Value);
HandleDestroyed += PreviewUserControl_HandleDestroyed;
}
protected override void OnMouseDoubleClick(MouseEventArgs e)
{
base.OnMouseDoubleClick(e);
view.ZoomExtents(extents.MinPoint, extents.MaxPoint);
RefreshView();
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
start = e.Location;
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (e.Button != MouseButtons.Left) return;
view.Orbit(Math.PI * (start.X - e.X) / Width, Math.PI * (e.Y - start.Y) / Height);
start = e.Location;
RefreshView();
}
protected override void OnPaint(PaintEventArgs e)
{
RefreshView();
}
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
device?.OnSize(Size);
RefreshView();
}
void PreviewUserControl_HandleDestroyed(object sender, EventArgs e)
{
CleanUp();
}
void RefreshView()
{
if (view == null) return;
view.Invalidate();
view.Update();
}
#endregion
}
}

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr