カスタムタスクペインを持つPowerPoint VSTO Addinと、トグルボタンで表示/非表示を定義するリボンが作成されました。カスタムタスクペインのステータス。これの基礎は、カスタムタスクペインのMicrosoft Walkthrough情報と、タスクペインとのリボンの同期でした。 最初のPowerPointウィンドウですべてがうまく動作します。タスクペインを2番目と3番目のPowerPointウィンドウに表示することはできますが、リボンのトグルボタンは最後に開いた/作成したPowerPointウィンドウにのみ反応し、アクティブなPowerPointウィンドウでは表示/非表示のタスクウィンドウに反応しません。別のウィンドウにあるC#VSTO-Powerpoint-TaskPanes
私はここに正確に同じ問題を説明し、別のスレッド発見しました: C# VSTO-Powerpoint-TaskPanes in separate windows.
をしかし、私は答えを理解していません。どちらも私はパワーポイントインスペクタラッパーを実装する方法がわかりません。
私はC#で新しく、「Inspector Wrapper」のようなキーワードを取得するのは私にとってはあまりありません。私はすでにネットを検索するのに何時間も費やしていますが、今まで成功していませんでした。
PowerPoint用の完全なコード例を得る機会はありますか?これはどのように動作するのですか?
コードを追加: 私は一般的なウォークスルーからコードを取っ:https://msdn.microsoft.com/en-us/library/bb608590.aspx、新たなプレゼンテーションのためのイベントでそれを変更:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Office = Microsoft.Office.Core;
namespace PowerPointAddIn1
{
public partial class ThisAddIn
{
private TaskPaneControl taskPaneControl1;
private Microsoft.Office.Tools.CustomTaskPane taskPaneValue;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.Application.AfterNewPresentation += new Microsoft.Office.Interop.PowerPoint.EApplication_AfterNewPresentationEventHandler(NewPresentation);
//taskPaneControl1 = new TaskPaneControl();
//taskPaneValue = this.CustomTaskPanes.Add(taskPaneControl1, "MyCustomTaskPane");
//taskPaneValue.VisibleChanged += new EventHandler(taskPaneValue_VisibleChanged);
}
void NewPresentation(Microsoft.Office.Interop.PowerPoint.Presentation oPres)
{
PowerPoint.Application app = this.Application;
PowerPoint.DocumentWindow docWin = null;
foreach (PowerPoint.DocumentWindow win in Globals.ThisAddIn.Application.Windows)
{
if (win.Presentation.Name == app.ActivePresentation.Name)
{
docWin = win;
}
}
this.taskPaneControl1 = new TaskPaneControl();
this.taskPaneValue = this.CustomTaskPanes.Add(taskPaneControl1, "MyCustomTaskPane", docWin);
this.taskPaneValue.VisibleChanged += new EventHandler(taskPaneValue_VisibleChanged);
}
private void taskPaneValue_VisibleChanged(object sender, System.EventArgs e)
{
Globals.Ribbons.ManageTaskPaneRibbon.toggleButton1.Checked =
taskPaneValue.Visible;
}
public Microsoft.Office.Tools.CustomTaskPane TaskPane
{
get
{
return taskPaneValue;
}
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
コード裁判を私たちと共有してください – Marcel
私はコードを一般的なチュートリアルから取りました:https://msdn.microsoft.com/en-us/library/bb608590.aspx –
あなたは2007年をターゲットにしていますか?そうでないかぎり、解決策は 'InspectorWrapper'ではなく、' CustomTaskPane'コレクションと関係しています。 – Chris