Aracılığıyla paylaş


DropDownListContentControl.PlaceholderText Özellik

Alır veya ayarlar içinde görüntülenen metin DropDownListContentControl 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 denetimi bir veri kaynağından verilerle doldurulur kadar görüntülenir.

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

Örnekler

Aşağıdaki kod örneği ekler yeni bir DropDownListContentControl belgenin başına.Kullanıcıların denetime haftanın bir günü adını seçebilirsiniz.Örnek ayarlar PlaceholderText bir gününü 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ı AddDropDownListControlAtSelection yönteminden ThisDocument_Startup yöntemi.

Dim dropDownListControl1 As Microsoft.Office.Tools.Word.DropDownListContentControl

Private Sub AddDropDownListControlAtSelection()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Select()
    dropDownListControl1 = Me.Controls.AddDropDownListContentControl("dropDownListControl1")
    With dropDownListControl1
        .DropDownListEntries.Add("Monday", "Monday", 0)
        .DropDownListEntries.Add("Tuesday", "Tuesday", 1)
        .DropDownListEntries.Add("Wednesday", "Wednesday", 2)
        .PlaceholderText = "Choose a day"
    End With
End Sub
private Microsoft.Office.Tools.Word.DropDownListContentControl dropDownListControl1;

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

    dropDownListControl1 = this.Controls.AddDropDownListContentControl("dropDownListControl1");
    dropDownListControl1.DropDownListEntries.Add("Monday", "Monday", 0);
    dropDownListControl1.DropDownListEntries.Add("Tuesday", "Tuesday", 1);
    dropDownListControl1.DropDownListEntries.Add("Wednesday", "Wednesday", 2);
    dropDownListControl1.PlaceholderText = "Choose a day";
}

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ı AddDropDownListControlAtSelection yönteminden ThisAddIn_Startup yöntemi.

Dim dropDownListControl1 As Microsoft.Office.Tools.Word.DropDownListContentControl

Private Sub AddDropDownListControlAtSelection()
    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()
    dropDownListControl1 = vstoDoc.Controls.AddDropDownListContentControl("dropDownListControl1")
    With dropDownListControl1
        .DropDownListEntries.Add("Monday", "Monday", 0)
        .DropDownListEntries.Add("Tuesday", "Tuesday", 1)
        .DropDownListEntries.Add("Wednesday", "Wednesday", 2)
        .PlaceholderText = "Choose a day"
    End With
End Sub
private Microsoft.Office.Tools.Word.DropDownListContentControl dropDownListControl1;

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

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

    dropDownListControl1 = vstoDoc.Controls.AddDropDownListContentControl("dropDownListControl1");
    dropDownListControl1.DropDownListEntries.Add("Monday", "Monday", 0);
    dropDownListControl1.DropDownListEntries.Add("Tuesday", "Tuesday", 1);
    dropDownListControl1.DropDownListEntries.Add("Wednesday", "Wednesday", 2);
    dropDownListControl1.PlaceholderText = "Choose a day";
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

DropDownListContentControl Arabirim

Microsoft.Office.Tools.Word Ad Alanı