コード例 #1
0
        void inspectors_NewInspector(Outlook.Inspector Inspector)
        {
            try
            {
                // When a new Inspector opens, create a task pane and attach
                // it to this Inspector. Also add the task pane<-->Inspector
                // mapping to the collection.
                Office.CustomTaskPane taskPane = taskPaneFactory.CreateCTP(
                    "TestOutlook2007Addin.SimpleControl", taskPaneTitle,
                    Inspector);
                inspectorPanes.Add(taskPane, Inspector);

                // Sink the Close event on this Inspector to make sure the
                // task pane is also destroyed.
                itemEvents =
                    (Outlook.ItemEvents_10_Event)Inspector.CurrentItem;
                InspectorCloseHandler chc =
                    new InspectorCloseHandler(this, taskPane);
                itemEvents.Close +=
                    new Outlook.ItemEvents_10_CloseEventHandler(
                        chc.CloseEventHandler);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #2
0
 public void CTPFactoryAvailable(Office.ICTPFactory CTPFactoryInst)
 {
     if (CTPFactoryInst != null)
     {
         // Create a new task pane.
         taskPane = CTPFactoryInst.CreateCTP(
             "Microsoft.Samples.Vsto.CS.TaskPaneUI",
             "Contoso");
         taskPane.Visible = true;
     }
 }
コード例 #3
0
        public void CTPFactoryAvailable(Office.ICTPFactory CTPFactoryInst)
        {
            try
            {
                String taskPaneTitle = ConfigurationManager.AppSettings["taskPaneTitle"];
                if (taskPaneTitle == null)
                {
                    taskPaneTitle = "default";
                }

                taskPane = CTPFactoryInst.CreateCTP(
                    "TestExcel2007Addin.SimpleControl", taskPaneTitle, Type.Missing);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }