Share via


ComboBoxContentControl インターフェイス

定義

文書上のコンボ ボックスを表します。

public interface class ComboBoxContentControl : IDisposable, Microsoft::Office::Tools::Word::ContentControlBase, System::ComponentModel::IComponent, System::ComponentModel::ISupportInitialize, System::Windows::Forms::IBindableComponent
[System.Runtime.InteropServices.Guid("fff2d316-e224-4cd9-a10c-3edf95689a6d")]
public interface ComboBoxContentControl : IDisposable, Microsoft.Office.Tools.Word.ContentControlBase, System.ComponentModel.IComponent, System.ComponentModel.ISupportInitialize, System.Windows.Forms.IBindableComponent
[<System.Runtime.InteropServices.Guid("fff2d316-e224-4cd9-a10c-3edf95689a6d")>]
type ComboBoxContentControl = interface
    interface ContentControlBase
    interface IBindableComponent
    interface IComponent
    interface IDisposable
    interface ISupportInitialize
Public Interface ComboBoxContentControl
Implements ContentControlBase, IBindableComponent, IComponent, IDisposable, ISupportInitialize
属性
実装

次のコード例では、ドキュメントの先頭に新しい ComboBoxContentControl を追加します。 ユーザーは、コントロールによって表示される色名を選択するか、新しい色の名前を入力できます。

このバージョンは、ドキュメント レベルのカスタマイズ用です。 このコードを使用するには、プロジェクトの ThisDocument クラスに貼り付け、 メソッドから メソッドをAddComboBoxControlAtSelectionThisDocument_Startup呼び出します。

private Microsoft.Office.Tools.Word.ComboBoxContentControl comboBoxControl1;

private void AddComboBoxControlAtSelection()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Select();

    comboBoxControl1 = this.Controls.AddComboBoxContentControl("comboBoxControl1");
    comboBoxControl1.DropDownListEntries.Add("Red", "Red", 0);
    comboBoxControl1.DropDownListEntries.Add("Green", "Green", 1);
    comboBoxControl1.DropDownListEntries.Add("Blue", "Blue", 2);
    comboBoxControl1.PlaceholderText = "Choose a color, or enter your own";
}
Dim comboBoxControl1 As Microsoft.Office.Tools.Word.ComboBoxContentControl

Private Sub AddComboBoxControlAtSelection()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Select()
    comboBoxControl1 = Me.Controls.AddComboBoxContentControl("comboBoxControl1")
    With comboBoxControl1
        .DropDownListEntries.Add("Red", "Red", 0)
        .DropDownListEntries.Add("Green", "Green", 1)
        .DropDownListEntries.Add("Blue", "Blue", 2)
        .PlaceholderText = "Choose a color, or enter your own"
    End With
End Sub

このバージョンは、アプリケーション レベルのアドイン用です。 このコードを使用するには、プロジェクトの ThisAddIn クラスに貼り付け、 メソッドから メソッドをAddComboBoxControlAtSelectionThisAddIn_Startup呼び出します。

private Microsoft.Office.Tools.Word.ComboBoxContentControl comboBoxControl1;

private void AddComboBoxControlAtSelection()
{
    if (this.Application.ActiveDocument == null)
        return;

    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.Paragraphs[1].Range.InsertParagraphBefore();
    vstoDoc.Paragraphs[1].Range.Select();

    comboBoxControl1 = vstoDoc.Controls.AddComboBoxContentControl(
        "comboBoxControl1");
    comboBoxControl1.DropDownListEntries.Add("Red", "Red", 0);
    comboBoxControl1.DropDownListEntries.Add("Green", "Green", 1);
    comboBoxControl1.DropDownListEntries.Add("Blue", "Blue", 2);
    comboBoxControl1.PlaceholderText = "Choose a color, or enter your own";            
}
Dim comboBoxControl1 As Microsoft.Office.Tools.Word.ComboBoxContentControl

Private Sub AddComboBoxControlAtSelection()
    If Me.Application.ActiveDocument Is Nothing Then
        Return
    End If

    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    vstoDoc.Paragraphs(1).Range.InsertParagraphBefore()
    vstoDoc.Paragraphs(1).Range.Select()
    comboBoxControl1 = vstoDoc.Controls.AddComboBoxContentControl("comboBoxControl1")
    With comboBoxControl1
        .DropDownListEntries.Add("Red", "Red", 0)
        .DropDownListEntries.Add("Green", "Green", 1)
        .DropDownListEntries.Add("Blue", "Blue", 2)
        .PlaceholderText = "Choose a color, or enter your own"
    End With
End Sub

注釈

には ComboBoxContentControl 、ユーザーが選択できる項目の一覧が表示されます。 ユーザーは、 に独自のテキストを ComboBoxContentControl入力することもできます。

ユーザーが編集できないアイテムのドロップダウン リストをテキスト ボックスに表示するには、 を DropDownListContentControl使用します。

内の項目の一覧に ComboBoxContentControlアクセスするには、 プロパティを DropDownListEntries 使用します。

注意

これは、Visual Studio Tools for Office Runtime によって実装されたインターフェイスです。 コードに実装されるものではありません。 詳細については、「Visual Studio Tools for Office ランタイムの概要」を参照してください。

コンテンツ コントロール

ComboBoxContentControl、Microsoft Office Wordでドキュメントとテンプレートを設計するために使用できる 8 種類のコンテンツ コントロールの 1 つです。 コンテンツ コントロールには、フォームのように入力を制御するユーザー インターフェイス (UI) があります。 コンテンツ コントロールを使用して、ユーザーがドキュメントまたはテンプレートの保護されたセクションを編集できないようにしたり、コンテンツ コントロールをデータ ソースにバインドしたりすることもできます。 詳細については、「 コンテンツ コントロール」を参照してください。

使用

ここでは、.NET Framework 4 以降を対象とする Office プロジェクトで使用される型のバージョンについて説明します。 .NET Framework 3.5 を対象とするプロジェクトでは、この型のメンバーが異なること、およびこのコード例が動作しないことがあります。 .NET Framework 3.5 を対象とするプロジェクトの型の詳細については、Visual Studio 2008 ドキュメントの次の参照セクションを参照してください。http://go.microsoft.com/fwlink/?LinkId=160658

プロパティ

Application

Microsoft Office Word の現在のインスタンスを表す Application を取得します。

Container

文書上のコンボ ボックスを表します。

(継承元 ContentControlBase)
ContainerComponent

文書上のコンボ ボックスを表します。

(継承元 ContentControlBase)
Creator

ComboBoxContentControl が作成されたアプリケーションを示す 32 ビット整数を取得します。

DefaultDataSourceUpdateMode

DataSourceUpdateMode の既定の ContentControlBase を取得または設定します。

(継承元 ContentControlBase)
DefaultTextStyle

ComboBoxContentControl 内のテキストへの書式設定に使用する、文字スタイルの名前を取得します。

DropDownListEntries

ComboBoxContentControl によって表示される項目のコレクションを取得します。

ID

コンテンツ コントロールを示す一意の数字を取得します。

(継承元 ContentControlBase)
InnerObject

ContentControlBase の基になる ContentControl オブジェクトを取得します。

(継承元 ContentControlBase)
LockContentControl

ドキュメントから ComboBoxContentControl を削除できるかどうかを指定する値を取得または設定します。

LockContents

ComboBoxContentControl のコンテンツを編集できるかどうかを指定する値を取得または設定します。

MultiLine

ComboBoxContentControl に改行を含めることができるかどうかを指定する値を取得または設定します。

Parent

ComboBoxContentControl の親を取得します。

ParentContentControl

別のコンテンツ コントロールに入れ子になっている ComboBoxContentControl の親コンテンツ コントロールを取得します。

PlaceholderText

ユーザーによる操作やその他の操作によってテキストが変更されない限り、ComboBoxContentControl に表示されるテキストを取得または設定します。

Range

ComboBoxContentControl のコンテンツを表す Range を取得します。

ShowingPlaceholderText

ComboBoxContentControl が現在表示されているプレースホルダー テキストであるかどうかを示す値を取得します。

Tag

ComboBoxContentControl に関連付ける文字列を取得または設定します。

Temporary

コントロールが編集されたときに文書から ComboBoxContentControl を自動的に削除するかどうかを指定する値を取得または設定します。

Text

ComboBoxContentControl 内のテキストを取得または設定します。

Title

ComboBoxContentControl のタイトルを取得または設定します。

XMLMapping

カスタム XML 部分の ComboBoxContentControl と要素間のバインドを表す XMLMapping を取得します。

メソッド

Copy()

文書からクリップボードに、ComboBoxContentControl をコピーします。

Cut()

ComboBoxContentControl を文書から削除し、クリップボードに追加します。

Delete(Boolean)

動的に作成されたコンテンツ コントロールを文書から削除し、ドキュメントの ControlCollection からも削除します。

(継承元 ContentControlBase)
SetPlaceholderText(BuildingBlock, Range, String)

T:Microsoft.Office.Interop 内のテキストを表示します。Word。のプレースホルダー テキストComboBoxContentControlとしての BuildingBlock、Range、、または文字列。

イベント

Added

コンテンツ コントロールが文書に追加された後に発生します。

(継承元 ContentControlBase)
BindingContextChanged

BindingContextContentControlBase プロパティの値が変更された場合に発生します。

(継承元 ContentControlBase)
ContentUpdating

コンテンツ コントロールがカスタム XML 部分にバインドされている場合、Microsoft Office Word がコンテンツ コントロール内のテキストを更新する直前に発生します。

(継承元 ContentControlBase)
Deleting

コンテンツ コントロールが文書から削除される直前に発生します。

(継承元 ContentControlBase)
Entering

ユーザーがコンテンツ コントロールをクリックしたとき、またはプログラムによってカーソルがコンテンツ コントロール内に移動したときに発生します。

(継承元 ContentControlBase)
Exiting

ユーザーがコンテンツ コントロールの外部をクリックしたとき、またはプログラムによってカーソルがコンテンツ コントロールの外部に移動したときに発生します。

(継承元 ContentControlBase)
StoreUpdating

コンテンツ コントロールにバインドされているカスタム XML 部分内のデータが Microsoft Office Word で更新される直前 (コンテンツ コントロール内のテキストが変更された後) に発生します。

(継承元 ContentControlBase)
Validated

コンテンツ コントロールの検証が正常に完了したときに発生します。

(継承元 ContentControlBase)
Validating

コンテンツ コントロール内のコンテンツを検証中であるときに発生します。

(継承元 ContentControlBase)

適用対象