c# - Clr dll .net 控件

标签 c# c++ winforms dll clr

我需要在运行时从 C# winforms 宿主项目动态加载 DLL 中的一些 .NET 控件。

例如:

1.dll contains control1

2.dll contains control2

3.dll contains control3

宿主应用程序可以加载任何此 dll-s,从 dll 获取控件并将其置于自身形式。

我试过:

__declspec(dllexport) TestCLRPlugin::Properties ^ GetControl()
{
    return gcnew TestCLRPlugin::Properties();
}

但是,clrcall 方法不能从 dll 中导出。

最佳答案

您需要使用 Assembly.LoadFrom方法,然后您可以使用反射从程序集中获取您想要的方法/类/等。如果您点击 MSDN 链接,会有很好的示例。

关于c# - Clr dll .net 控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10852445/

相关文章:

c++ - c++中的背景音乐

c# - 在 DataTable 中查找一行

c# - 保存来自选择查询的值,然后在更新查询 SQL Server CE 中使用它们

c# - 从 app.config 文件的 web.config 部分获取值?

c# - 从 WSDL 文件在 Visual Studio 中创建 Web 服务代理

c# - 从 Gridview 获取动态创建的复选框值 |网站

c++ - 编译器错误 : invalid conversion from 'int' to 'int*' [-fpermissive]|

c++ - Qt 拆分 QString

c# - 如何从 gridview 将多条记录添加到 SQL Server 表中?

c# - 生成 pgp key 时出现问题?