مشاركة عبر


DocumentBase.Controls الخاصية

يحصل تشغيل مجموعة المدارة عناصر التحكم الموجودة في مستند.

مساحة الاسم:  Microsoft.Office.Tools.Word
التجميع:  Microsoft.Office.Tools.Word.v4.0.Utilities (في Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

بناء الجملة

'إقرار
Public ReadOnly Property Controls As ControlCollection
    Get
public ControlCollection Controls { get; }

قيمة الخاصية

النوع: Microsoft.Office.Tools.Word.ControlCollection
ControlCollectionالتي يحتوي تشغيل الجميع عناصر التحكم التي تتم إدارتها تشغيل مستند.

ملاحظات

يمكن أن يحتوي مستند في الحلول المكتب على Windows Forms عناصر التحكم والمضيف عناصر التحكم. لمزيد من المعلومات، راجع عناصر التحكم الموجودة في مستندات Office.

أمثلة

يضيف مثال التعليمة البرمجية التالية إلى النص أول الفقرة وقم بإنشاء عنصر Bookmarkعنصر التحكم الذي يشمل فقرة. تعليمات برمجية ثم يظهر صندوق رسالة يعرض العدد الإجمالي لعناصر التحكم الموجودة في مستند. إلى لاستخدام هذا المثال، قم بتشغيلها من ThisDocumentالفئة في مشروع المستوى مستند.

Private Sub DocumentControls()
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.Paragraphs(1).Range.Text = "This is some sample text."
    Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    MessageBox.Show("Total number of controls: " & Me.Controls.Count.ToString())
End Sub
private void DocumentControls()
{
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.Text = "This is some sample text.";
    this.Controls.AddBookmark(this.Paragraphs[1].Range, "Bookmark1");
    MessageBox.Show("Total number of controls: " +
        this.Controls.Count.ToString());
}

أمن NET Framework.

راجع أيضًَا

المرجع

DocumentBase الفئة

DocumentBase الأعضاء

Microsoft.Office.Tools.Word مساحة الاسم

موارد أخرى

عناصر التحكم الموجودة في مستندات Office