一、添加DLL程序集
AnyCAD.Foundation.Net.dll
AnyCAD.Presentation.Net.dll
AnyCAD.Exchange.Net.dll
二、初始化控件
1.首先创建一个窗体
2.在窗体上放置一个Panel用来放置三维控件
3.初始化控件
完整代码如下:
using AnyCAD.Presentation;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AnyCAD.Platform;
using System.IO;
namespace dlanycad
{
public partial class Form1 : Form
{
private RenderWindow3d m_RenderView = null;
public AnyCAD.Presentation.RenderWindow3d RenderView
{
get { return m_RenderView; }
set { m_RenderView = value; }
}
public Form1()
{
InitializeComponent();
// Add 3D RenderView to container.
var container = this.panel1;
m_RenderView = new AnyCAD.Presentation.RenderWindow3d();
m_RenderView.Size = container.ClientSize;
m_RenderView.Dock = System.Windows.Forms.DockStyle.Fill;
container.Controls.Add(m_RenderView);
}
}
}
4.编译运行,效果如下: