ComboBoxContentControl.PlaceholderText الخاصية
الحصول أو تعيين نص هو dهوplayed في ComboBoxContentControlحتى نص هو تم تغييرهها بواسطة إجراء مستخدم أو بعض غير ذلك عملية.
مساحة الاسم: Microsoft.Office.Tools.Word
التجميع: Microsoft.Office.Tools.Word (في Microsoft.Office.Tools.Word.dll)
بناء الجملة
'إقرار
Property PlaceholderText As String
Get
Set
string PlaceholderText { get; set; }
قيمة الخاصية
النوع: System.String
نص الذي هو dهوplayed في عنصر التحكم إلى أن نص هو تم تغييرهها بواسطة إجراء مستخدم أو عملية غير ذلك.
ملاحظات
نص العنصر النائب هو dهوplayed حتى قيام مستخدم بتحديد عنصر أو كتابة القيمة جديدة في عنصر التحكم، أو عنصر التحكم هو معبأ بالبيانات من مصدر بيانات.
لتعيين العنصر النائب لنص التي هو في على Microsoft.Office.Interop.Word.BuildingBlockأو Range، استخدم SetPlaceholderTextالأسلوب.
أمثلة
يلي تعليمات برمجية في المثال إضافة جديد ComboBoxContentControlإلى بداية مستند. يمكن أن يقوم المستخدمون بتحديد اسم اللون المعروض بواسطة عنصر تحكم، أو يمكنك كتابة اسم لاللون جديد. يعين المثال PlaceholderTextخاصية إلى سلسلة التي يطالب مستخدم إلى اختيار اللون.
Th هو الإصدار هو لتخصيص المستوى مستند. إلى استخدام هذا الرمز، قم بلصقه في إلى ThisDocumentالفئة في مشروع، واستدعاء AddComboBoxControlAtSelectionأسلوب من ThisDocument_Startupالأسلوب.
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";
}
Th هو الإصدار هو للوظيفة الإضافية المستوى تطبيق. إلى استخدام هذا الرمز، قم بلصقه في إلى ThisAddInالفئة في مشروع، واستدعاء AddComboBoxControlAtSelectionأسلوب من ThisAddIn_Startupالأسلوب.
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.
- الثقة الكاملة للمتصل الفوري. يتعذر استخدام هذا العضو بواسطة التعليمات البرمجية الموثوق بها جزئيًا. لمزيد من المعلومات، راجع باستخدام مكتبات من تعليمات برمجية موثوق بها جزئي.