创建我的winform应用程序的activex控件 [英] Create activex control of my winform application

查看:103
本文介绍了创建我的winform应用程序的activex控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有两个winform应用程序,我称之为 Prog1 Prog2



Prog2 中,我有一个包含gridview和它旁边面板的表单。当网格的每一行被激活时, Prog1 (基于该激活行的信息)应在面板中运行。



有人告诉我,可以通过创建我的 Prog1 的ActiveX控件来完成!现在我想知道它是否有可能,我怎么能这样做?



注意:我在很多搜索中找到了如何通过类库项目创建一个activex控件,但我不知道如何将它链接到我的.exe应用程序( Prog1 )。



编辑:的确,我的两个winform应用程序的工作方式如下:

1)第一个用户在 Prog2 中选择一行网格,然后按下运行 Prog1 的按钮选择该行。



2)Prog1有一个设计面板,允许用户绘制图表和然后保存它。(这里重要的是Prog1将绘制图表的数据保存在数据库中但不作为文件保存。)



3)这两个步骤对网格的所有行重复。



4)问题在于此步骤,当用户选择一行网格并且他想要查看时在网格旁边的面板中预览其相关图表,没有打开设计区域(I m ean Prog1)。这就是我想要的......

Hi all,
I have two winform applications that i will call them Prog1 and Prog2.

In Prog2 i have a form contains of a gridview and a panel next to it. When each row of the grid become activated, Prog1 (based on information of that activated row) should run in the panel.

Someone tells me, it can be done by creating an ActiveX control of my Prog1 !? Now i want to know if it is possible and also how can i do that?

Note: I have found in my lots of searches how can i create an activex control by class library project but i do not know how can i link it to my .exe application (Prog1).

Indeed, my two winform apps work like below:
1) First user select one row of the grid in Prog2 and then press a button that runs Prog1 for this selected row.

2) Prog1 has a design panel, allows user to draw a diagram and then save it.(What is important here is that Prog1 saves the data of the drawn diagram just in database but not as a file.)

3) These two steps is repeated for all of rows of the grid.

4) The problem is in this step, when the user select a row of the grid and he wants to see just a preview of its related diagram,in the panel next to the grid, without opening design area (I mean Prog1).That is what i want exactly...

推荐答案

是的,你可以创建一个Singleton COM(不需要它是ActiveX)对象来服务作为从一个应用程序向另一个应用程序发送消息的机制。但是,与使用Windows / .Net中已有的其他一些标准的进程间通信基础结构相比,它需要更多的努力。



这里(MSDN [ ^ ])列出了其中一些。它还需要一些努力才能实现,但.Net Remoting也可以达到目的并实现一种机制,允许您从对象的确切位置抽象自己(可以在相同或不同的AppDomain中,甚至可以在不同的AppDomain中)电脑)。如果寻找更多进化的东西你可以看看WCF,你可以在 WCF:从初学者的角度来看&教程 [ ^ ]和从.NET Remoting到Windows Communication Foundation(WCF) [ ^ ]。



编辑:现在,从您的评论和编辑。创建一个共享库(DLL)并放置编辑和预可视化所需的所有类,现在可以从两个应用程序(prog1,prog2)引用和使用该功能。



--V.Lorz
Yes, you can create one Singleton COM (no need for it to be ActiveX) object to serve as a mechanism for sending messages from one application to the other. But it will require more effort than using some other standard inter-process communications infrastructures already available in Windows/.Net.

Here (MSDN[^]) are listed some of them. It also requires some effort to implement, but .Net Remoting also serves the purpose and implements a mechanism which allows you to 'abstract' yourself from the exact 'location' of the objects (can be in the same or different AppDomain or even in different computers). If looking for something more evolved you can take a look at WCF, you can find a tutorial about it in WCF: From a Beginner's perspective & a Tutorial[^] and here From .NET Remoting to the Windows Communication Foundation (WCF)[^].

Now, from your comments and edit. Create one shared library (DLL) and put there all classes needed for edition and previsualization, now that functionality can be referenced and used from both applications (prog1, prog2).

--V.Lorz


这篇关于创建我的winform应用程序的activex控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆