如何将CAD窗口显示在VB.NET窗体下
展开全部
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Interop;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
AcadApplication app;
public Form1()
{
InitializeComponent();
}
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr SetParent(IntPtr child, IntPtr newParent);
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern IntPtr GetParent(IntPtr hWnd);
private void Form1_Load(object sender, EventArgs e)
{
app = (AcadApplication)Marshal.GetActiveObject("AutoCad.Application");
SetParent(new IntPtr(app.HWND), this.Handle);
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Interop;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
AcadApplication app;
public Form1()
{
InitializeComponent();
}
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr SetParent(IntPtr child, IntPtr newParent);
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern IntPtr GetParent(IntPtr hWnd);
private void Form1_Load(object sender, EventArgs e)
{
app = (AcadApplication)Marshal.GetActiveObject("AutoCad.Application");
SetParent(new IntPtr(app.HWND), this.Handle);
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询