简体   繁体   中英

VSTO C# in Powerpoint: WindowSelectionChange Event

I am new to VSTO and C# and have a question regarding events. I'm trying to fire an event when the user selects something within PowerPoint (eg a shape, slide, etc).

I found a working solution for VBA in the Office documentation here and some more info for a Word selection handler here , however I'm clueless on how and where to add it in my ThisAddIn.cs context.

I'm currently working from a fresh C# PowerPoint VSTO Addin 空白 C# PowerPoint VSTO 插件

Any pointers into the right direction are highly welcome. Thanks!

Found this and it works:

    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        this.Application.WindowSelectionChange += Application_WindowSelectionChange;

    }

    private void Application_WindowSelectionChange(PowerPoint.Selection Sel)
    {
        //throw new NotImplementedException();
        MessageBox.Show("Hello");
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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