怎样在C#中动态加载可视化组件?

zzyxb 2002-08-25 08:02:57
加精
我用C#开发了一个带GUI的组件(*.dll),现在想在另一C#程序中动态加载该组件(需要显示图形界面),怎样实现?
...全文
78 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
cmmi 2002-08-29
  • 打赏
  • 举报
回复
请参考下面的范例:
(采用 C# + XML 开发,能动态加载按测试组件标准开发的组件。)
http://tqm.8u8.com/commontest/commontester.zip
http://tqm.8u8.com/commontest/tester.zip (含代码)
火鸟李国平 2002-08-29
  • 打赏
  • 举报
回复
看看
zzyxb 2002-08-29
  • 打赏
  • 举报
回复
我需要调用的是很多不同的DLL,关键是怎样解决这些DLL中GUI界面的显示!!!!!!
qf0421 2002-08-26
  • 打赏
  • 举报
回复
Assembly yourdll = Assembly.LoadFrom(/*dll name*/);
Type[] types = yourdll.GetTypes();
foreach( Type t in types )
{
if( t is typeof( yourcomponentType ) )
{
object o = Activator.CreateInstance( t );
yourcomponentType yourComponent = o as yourcomponentType;
if( null != yourComponent )
{
//Add to your current control.Controls and show it
}
}
}
haixu 2002-08-26
  • 打赏
  • 举报
回复
同楼上

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧