Share via


CustomTaskPaneCollection クラス (2007 System)

更新 : 2007 年 11 月

Microsoft Office アプリケーションのカスタム作業ウィンドウのコレクションを表します。

名前空間 :  Microsoft.Office.Tools
アセンブリ :  Microsoft.Office.Tools.Common.v9.0 (Microsoft.Office.Tools.Common.v9.0.dll 内)

構文

'宣言
Public NotInheritable Class CustomTaskPaneCollection _
    Implements IEnumerable(Of CustomTaskPane), IEnumerable,  _
    ISupportInitialize, IDisposable
'使用
Dim instance As CustomTaskPaneCollection
public sealed class CustomTaskPaneCollection : IEnumerable<CustomTaskPane>, 
    IEnumerable, ISupportInitialize, IDisposable

解説

アプリケーションに対してカスタム作業ウィンドウの追加または削除を行ったり、既存のカスタム作業ウィンドウにアクセスしたりするには、アプリケーション レベルのアドインの CustomTaskPaneCollection クラスを使用します。

CustomTaskPaneCollection クラスの独自のインスタンスを作成しないでください。代わりに、アドイン プロジェクトの ThisAddIn クラスの CustomTaskPanes フィールドを使用します。ThisAddIn クラスの詳細については、「アプリケーション レベルのアドインのプログラミング」および「AddIn ホスト項目」を参照してください。

作業ウィンドウは、アプリケーション ウィンドウのいずれかの端に通常ドッキングされているユーザー インターフェイス パネルです。カスタム作業ウィンドウの作成方法の詳細については、「カスタム作業ウィンドウの概要」を参照してください。

次のコード例は、Add(UserControl, String) メソッドを使用してカスタム作業ウィンドウを作成する方法を示します。また、このコード例では、CustomTaskPane オブジェクトのプロパティを使用してカスタム作業ウィンドウの既定の外観を変更します。このコード例は、CustomTaskPane クラスのトピックで取り上げているコード例の一部分です。

Private myUserControl1 As MyUserControl
Private WithEvents myCustomTaskPane As Microsoft.Office.Tools.CustomTaskPane

Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles Me.Startup

    myUserControl1 = New MyUserControl()
    myCustomTaskPane = Me.CustomTaskPanes.Add(myUserControl1, "New Task Pane")

    With myCustomTaskPane
        .DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionFloating
        .Height = 500
        .Width = 500
        .DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight
        .Width = 300
        .Visible = True
    End With
End Sub
private MyUserControl myUserControl1;
private Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    myUserControl1 = new MyUserControl();
    myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1,
        "New Task Pane");

    myCustomTaskPane.DockPosition =
        Office.MsoCTPDockPosition.msoCTPDockPositionFloating;
    myCustomTaskPane.Height = 500;
    myCustomTaskPane.Width = 500;

    myCustomTaskPane.DockPosition =
        Office.MsoCTPDockPosition.msoCTPDockPositionRight;
    myCustomTaskPane.Width = 300;

    myCustomTaskPane.Visible = true;
    myCustomTaskPane.DockPositionChanged +=
        new EventHandler(myCustomTaskPane_DockPositionChanged);
}

継承階層

System.Object
  Microsoft.Office.Tools.CustomTaskPaneCollection

スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

参照

参照

CustomTaskPaneCollection メンバ

Microsoft.Office.Tools 名前空間

その他の技術情報

アプリケーション レベルのアドインのプログラミング

カスタム作業ウィンドウの概要

複数のアプリケーション ウィンドウでカスタム作業ウィンドウを管理する

方法 : カスタム作業ウィンドウをアプリケーションに追加する

チュートリアル : カスタム作業ウィンドウからのアプリケーションの自動化