ComboBoxContentControl.PlaceholderText Özellik
Alır veya ayarlar görüntülenen metin ComboBoxContentControl kadar metin değiştiren bir kullanıcı eylemi veya bazı diğer işlem.
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
Get
Set
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ştirilinceye kadar denetimde görüntülenen metin.
Açıklamalar
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 için bir Microsoft.Office.Interop.Word.BuildingBlock veya bir Range, kullanma SetPlaceholderText yöntemi.
Örnekler
Aşağıdaki kod örneği, yeni bir ekler ComboBoxContentControl başına belge. Kullanıcılar denetim tarafından görüntülenen renk adı seçebilir veya yeni bir renk adını yazarak ekleyebilirsiniz. Örnek ayarlar PlaceholderText Seçilecek kullanıcı ister bir dize özelliğirengi.
Belge düzeyinde özelleştirme için değil. 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";
}
Bu bir uygulama düzeyinde eklentisi sürümüdür. 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üvenilir kod tarafından Kitaplıklar kullanma.