OLE Container for .NET
I'm working on a project that requires me to load an OLE object and render it in a .NET WinForm app (C#). Unlike VB6 .NET h开发者_开发知识库as no built in OLE container, and the recommended approach is to use the WebBrowser control which supports displaying ActiveX content. The issue I have is the provider of the OLE object in question does not have an ActiveX control available.
Simply put is there any way to load an OLE object onto a WinForm? Or will I need to write an ActiveX control that loads the OLE Object? If the latter, does anyone have an example of this, or recommended reading material?
cheers,
Marc.
You can use my control OLE Container surrogate for .NET
I made a simple user control that provides a replacement for the VB6 OLE Container control you can download the source code from my blog: http://blogs.artinsoft.net/Mrojas/archive/2012/01/23/Quick-replacement-for-the-VB6-OLE-Container-Control-in-NET.aspx
It has a wrapper for ActiveX controls, AxHost. But if you mean OLE Linking and Embedding, no, that's dead technology. It used to be possible with DsoFramer but that has been removed from the MSFT download site due to serious Office compatibility problems. You might be able to dig up a copy somewhere. Long term, you should avoid this, OLE has no future.
There's an alternative mechanism suggested at Visual Studio 2005 and Visual Studio .NET do not provide an OLE container control for Windows Forms and How to use the WebBrowser control to open Office documents in Visual C# 2005 or in Visual C# .NET.
精彩评论