PowerPoint C# - Adding Shape with a Listener -


makes

I add, trying in writing, which shall be a new slide in C # for PowerPoint and text boxes Adds when some action is done Now I have an action where it opens Notepad, but I want to call it another function.

The current code looks like this:

  PowerPoint.Shape sendQuestion = slide.Shapes.AddTextbox (Office.MoTextOrentation.msoTextOrientationHorizontal, Slaidvidth - 200, Slaidhit - 50, 200 , 50); SendQuestion.Name = "Submit Questions"; SendQuestion.TextFrame.TextRange.InsertAfter ("Submit Question"); SendQuestion.ActionSettings [PowerPoint.PpMouseActivation.ppMouseClick] .Action = PowerPoint.PpActionType.ppActionRunProgram; SendQuestion.ActionSettings [PowerPoint.PpMouseActivation.ppMouseClick] .Run = @ "C: \ WINDOWS \ system32 \ notepad.exe";    

In this addin-in startup mode, start Application_WindowSelectionChange event handler.

  public void it Addin_startap (object sender, System.EventArgs e) {this.Application.WindowSelectionChange + = Application_WindowSelectionChange; }   

The event handler, you may have the following code -

  public void application_WindowSelectionChange (PowerPoint.Selection sel) {if (sel.Type = = PowerPoint.PpSelectionType.ppSelectionShapes) {if (sel.ShapeRange.Name == "MyTextBox") {// make sure action}}   

Also added in-shutdown method , You will need to do this -

  Public Zero This AdDyn_startup (Object Sender, System.EventArgs e) {This application. Window selection - change - = modify applications_windows; }    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -