如何在VSTO 2010中创建事件c# [英] how to we create the events in the VSTO 2010 c#

查看:230
本文介绍了如何在VSTO 2010中创建事件c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在c#中开发了VSTO插件,现在我想将事件添加到SheetChanged,SheetSelectionChanged,WorkBookActivate,WorkBookDeactivate。我怎样才能实现这个目标?

我可以使用相同的Commandbar事件来执行此操作吗?或者命令栏和VSTO事件处理程序之间有什么区别吗?请帮助我。

Hi,
I have developed the VSTO addin in c# and now i want to add event to SheetChanged,SheetSelectionChanged,WorkBookActivate, WorkBookDeactivate. How can I achieve this?
Can I use the same Commandbar event to do this? Or is there any difference between the commandbars and VSTO event handlers?Please help me in this.

推荐答案

private void InternalStartup()
       {
           this.Startup += new System.EventHandler(ThisAddIn_Startup);
           this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
           this.Application.DocumentOpen += new Word.ApplicationEvents4_DocumentOpenEventHandler(Application_DocumentOpen);
           this.Application.DocumentChange += new Word.ApplicationEvents4_DocumentChangeEventHandler(Application_DocumentChange);
           this.Application.DocumentBeforeClose += new Word.ApplicationEvents4_DocumentBeforeCloseEventHandler(Application_DocumentBeforeClose);
           this.Application.DocumentBeforeSave += Application_DocumentBeforeSave;
           ((Word.ApplicationEvents4_Event)Application).NewDocument += NewDocumentEvent;
       }


这篇关于如何在VSTO 2010中创建事件c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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