ComboBoxContentControl.DropDownListEntries Özellik
Tarafından görüntülenen öğeler koleksiyonu alır ComboBoxContentControl.
Ad alanı: Microsoft.Office.Tools.Word
Derleme: Microsoft.Office.Tools.Word (Microsoft.Office.Tools.Word.dll içinde)
Sözdizimi
'Bildirim
ReadOnly Property DropDownListEntries As ContentControlListEntries
ContentControlListEntries DropDownListEntries { get; }
Özellik Değeri
Tür: Microsoft.Office.Interop.Word.ContentControlListEntries
A ContentControlListEntries tarafından görüntülenen öğeleri içeren nesne ComboBoxContentControl.
Notlar
Eklediğinizde, bir ComboBoxContentControl bir belge için onu hiçbir öğe varsayılan olarak içerir.Öğe eklemek için Add yöntemi, DropDownListEntries özelliği.
Örnekler
Aşağıdaki kod örneği ekler yeni bir ComboBoxContentControl belgenin başına.Kullanıcılar Denetim tarafından görüntülenen renk adı seçebilir veya yeni bir renk adını yazabilirsiniz.Bu örnek DropDownListEntries denetim tarafından görüntülenen renk adlarını belirtmek için özellik.
Belge düzeyinde özelleştirme için değildir.Bu kodu kullanmak için içine Yapıştır ThisDocument sınıfı proje ve çağrı AddComboBoxControlAtSelection yönteminden ThisDocument_Startup yöntemi.
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
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";
}
Bir uygulama düzeyinde eklenti değildir.Bu kodu kullanmak için içine Yapıştır ThisAddIn sınıfı proje ve çağrı AddComboBoxControlAtSelection yönteminden ThisAddIn_Startup yöntemi.
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
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";
}
.NET Framework Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen güvenilen kod kitaplıklarını kullanma.