Problem mit Microsoft Visio 2007 Add-In



  • Hallo zusammen
    Ich schreibe gerade ein Visio 2007 Add-In und habe folgendes Problem: Ich füge im Zusammenhang mit der Interaktion mit dem Benutzer eine zusätzliche CommandBar mit einem Button hinzu:

    private void ThisAddIn_Startup(object sender,System.EventArgs e){
       // determine the visio - application, the main - menu bar and the number of menu - items
       Visio.Application  appVso = Globals.ThisAddIn.Application;
       Office.CommandBars cbsCmd = (CommandBars)appVso.CommandBars;
    
       // define some oftenly used datatypes
       MsoBarPosition posTop = MsoBarPosition.msoBarTop;
       MsoControlType typBtn = MsoControlType.msoControlButton;
       object         nil    = Type.Missing;
    
       // create a new command - bar for the interaction with the user
       CommandBar cmbUml = (CommandBar)cbsCmd.Add("Fancy - UML", posTop,nil,true);
    
       // create a new button for creating a fancy - UML diagram
       CommandBarButton cbbGen = (CommandBarButton)cmbUml.Controls.Add(typBtn,nil,nil,nil,true);
       cbbGen.Caption = "Fancy - UML";
       cbbGen.Style = MsoButtonStyle.msoButtonCaption;
       cbbGen.Click += new _CommandBarButtonEvents_ClickEventHandler(btnGen_Click);
    
       // finally visible the command - bar
       cmbUml.Visible = true;
      }
    

    Das Problem ist nun, dass das Klicken keinen Event mehr auslöst, sobald ich ein neues Dokument generiere... 😕

    Hat vielleicht jemand von euch bereits einmal ähnliche Probleme gehabt?

    Mfg Ishlidur


Anmelden zum Antworten