tailieunhanh - Developing Visual Studio .NET Macros and Add-Ins phần 10
Các đối tượng Office bao gồm một số sự kiện mà mã của bạn có thể đáp ứng. Ví dụ, đối tượng bao gồm một sự kiện được gọi là WorkbookOpen, xảy ra khi người sử dụng Excel mở ra một bảng tính hoặc khi một chương trình tự động hóa gây ra Excel để mở một bảng tính. | 344 Chapter 15 similar to the Macro Explorer that lists scripts in other languages enabling you to double-click the scripts in this window to run them. The add-in I describe here does just that. It has a tool window containing a treeview control that lists the scripts in a given directory. If you double-click the script the script runs. Like many of the previous add-ins this one uses the VSUserControlHost that I described in Using the Form Designer with a Tool Window in Chapter 7. And as for the other add-ins be sure to add a COM reference to the VSUserControlHost Type Library. Here s the Connect module for the add-in Imports imports Extensibility imports Imports EnvDTE GuidAttribute F3D6C34F-CCDB-4D03-94D3-C9E5A15A9491 ProgIdAttribute _ Public Class Connect W vs Implements Implements IDTCommandTarget Note I changed applicationObject to public shared Public Shared applicationObject As Dim addInInstance As Private doc As Nothing Private toolwin As Window Nothing Public Sub OnBeginShutdown ByRef custom As _ Implements End Sub Public Sub OnAddInsUpdate ByRef custom As _ Implements End Sub Public Sub OnStartupComplete ByRef custom As _ Implements End Sub Public Sub OnDisconnection ByVal RemoveMode As _ ByRef custom As _ Implements End Sub Public Sub OnConnection ByVal application As Object _ ByVal connectMode As _ ByVal addInInst As Object ByRef custom As _ Implements Team-Fiy Integrating with Other Products 345 applicationobject .
đang nạp các trang xem trước