vsto之PPT幻灯片切换事件

时间:2023-02-06 20:36:56

在ThisAddIn_Startup函数中调用  Globals.ThisAddIn.Application.SlideSelectionChanged += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideSelectionChangedEventHandler(Application_SlideSelectionChanged);  即可,如下:

   private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {      
                   
            //幻灯片切换时调用的事件       
           Globals.ThisAddIn.Application.SlideSelectionChanged += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideSelectionChangedEventHandler(Application_SlideSelectionChanged);
        }

    
       
        //幻灯片切换时执行的函数
        void Application_SlideSelectionChanged(PowerPoint.SlideRange sldRange)
        {
            #region 自己的相关逻辑       
            #endregion
        }