简体   繁体   English

如何在.NET(C#)中扩展COM控制?

[英]How can COM control be extended in .NET (C#)?

I am using MapPoint COM in small tool for work. 我正在使用小型工作工具MapPoint COM。 It takes addresses from text file and imports as stops to MapPoint. 它从文本文件获取地址,并将其作为站点导入MapPoint。

As far as I know there are not many features or methods I can work with to get more out of MapPoint COM. 据我所知,可以使用很多功能或方法来充分利用MapPoint COM。 Which brings me to a questions, how, if I may, extend COM to get more out of it? 这给我带来了一个问题,如果可以的话,如何扩展COM以从中获得更多收益?

Here are few ideas what I mean by extend 以下是我扩展的意思

  • External list (DataSource) for Waypoints 航点的外部列表(数据源)
  • Custom events for MapPoint.ActiveMap.ActiveRoute.Waypoints (ie when waypoint added, deleted, selection changed, etc) {not important if custom List can be set as datasource, see aove} MapPoint.ActiveMap.ActiveRoute.Waypoints的自定义事件(即,添加,删除,更改航路点时等等){如果自定义列表可以设置为数据源,则不重要,请参见上页}
  • Custom MapPoint.Waypoint Objects 自定义MapPoint.Waypoint对象

Write a wrapper COM control or library which exposes the MapPoint COM object's features as well as new features you write yourself. 编写一个包装程序COM控件或库,以公开MapPoint COM对象的功能以及您自己编写的新功能。

Edit: Here's more on wrapper classes: What is a wrapper class? 编辑:这是有关包装器类的更多信息: 什么是包装器类?

@Richard Brightwell's wrapper classes might help provide some of what you want but I think overall you are going to be limited. @Richard Brightwell的包装器类可能有助于提供您想要的一些东西,但我认为总体来说您将受到限制。 As @Hans Passant says, only Microsoft can change the innards of the MapPoint application. 正如@Hans Passant所说,只有Microsoft可以更改MapPoint应用程序的内部。

It is unclear what you mean by your waypoint data source, but you could easily write code that reads waypoint data from somewhere (anywhere) and then uses it to create waypoints (and/or pushpins) one at a time, in MapPoint. 目前尚不清楚航路点数据源的含义,但您可以轻松编写代码以从某个地方(任何地方)读取航路点数据,然后使用该代码一次在MapPoint中创建一个航路点(和/或图钉)。

You are never going to be able to add your own event types, unless your wrapper classes fire intermediate events. 除非包装类触发中间事件,否则您将永远无法添加自己的事件类型。 Eg. 例如。 Class method X might do X. X contains steps a,b,c and step b fires an event in your code . 类方法X可能执行X。X包含步骤a,b,c,而步骤b触发代码中的事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM