Aracılığıyla paylaş


DocumentBase.Controls Özellik

Belge üzerinde bulunan yönetilen denetimleri topluluğu alır.

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

Sözdizimi

'Bildirim
Public ReadOnly Property Controls As ControlCollection
public ControlCollection Controls { get; }

Özellik Değeri

Tür: Microsoft.Office.Tools.Word.ControlCollection
A ControlCollection , belgedeki tüm yönetilen denetimleri içerir.

Notlar

Office çözümünü belgedeki Windows Forms ve konak kontrolleri içerebilir.Daha fazla bilgi için bkz. Office Belgelerindeki Denetimler.

Örnekler

Aşağıdaki kod örneğinde, ilk paragrafa metin ekler ve oluşturur bir Bookmark paragraf kapsayan denetim.Kod daha sonra belgeyi denetimlerin toplam sayısını görüntüleyen bir ileti kutusu gösterir.Bu örneği kullanmak için, örneği belge düzeyi bir projedeki ThisDocument sınıftan çalıştırın.

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 Güvenliği

Ayrıca bkz.

Başvuru

DocumentBase Sınıf

Microsoft.Office.Tools.Word Ad Alanı

Diğer Kaynaklar

Office Belgelerindeki Denetimler