Aracılığıyla paylaş


ComboBoxContentControl.PlaceholderText Özellik

Alır veya ayarlar içinde görüntülenen metin ComboBoxContentControl metin kullanıcı eylemi veya başka bir işlem tarafından değiştirilene kadar.

Ad alanı:  Microsoft.Office.Tools.Word
Derleme:  Microsoft.Office.Tools.Word (Microsoft.Office.Tools.Word.dll içinde)

Sözdizimi

'Bildirim
Property PlaceholderText As String
string PlaceholderText { get; set; }

Özellik Değeri

Tür: System.String
Metin, kullanıcı eylemi veya başka bir işlem tarafından değiştirilene kadar denetimde görüntülenen metin.

Notlar

Yer tutucu metin, kullanıcı bir öğeyi seçer veya denetime yeni bir değer türleri ya da denetimi bir veri kaynağından verilerle doldurulur kadar görüntülenir.

Bulunduğu yer tutucu metni belirlemek için bir Microsoft.Office.Interop.Word.BuildingBlock veya bir Range, kullanma SetPlaceholderText yöntemi.

Ö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.Örnek ayarlar PlaceholderText bir renk seçmek için kullanıcıdan bir dize özelliğini.

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

Ayrıca bkz.

Başvuru

ComboBoxContentControl Arabirim

Microsoft.Office.Tools.Word Ad Alanı