请问如何调用Dll中的窗体?
在Dll中做了一个窗体,Dll的名称为Test.dll,Dll中有一个窗体的名称是DllForm,代码如下:
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;
namespace Test
{
public partial class DllForm : Form
{
public DllForm()
{
InitializeComponent();
}
private void DllForm_Load(object sender, EventArgs e)
{
}
}
}
再搞一个应用程序,在这个程序的一个窗体中调用Dll中的窗体,代码如下:
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 test;
namespace UseDllForm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form Dllform = new DllForm();
Dllform.ShowDialog(this);
}
}
}
编译应用程序不能通过,出现异常提示:
未能找到类型或命名空间名“test”(是否缺少 using 指令或程序集引用?)