Aracılığıyla paylaş


ControlExtensions.AddCheckedListBox Yöntem (ControlCollection, Double, Double, Double, Double, String)

Yeni bir ekler CheckedListBox çalışma sayfasında belirtilen boyutunu ve konumunu denetlemek.

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

Sözdizimi

'Bildirim
<ExtensionAttribute> _
Public Shared Function AddCheckedListBox ( _
    controls As ControlCollection, _
    left As Double, _
    top As Double, _
    width As Double, _
    height As Double, _
    name As String _
) As CheckedListBox
public static CheckedListBox AddCheckedListBox(
    this ControlCollection controls,
    double left,
    double top,
    double width,
    double height,
    string name
)

Parametreler

  • left
    Tür: System.Double
    Nokta denetiminin sol kenarına çalışma sayfasının sol kenarı arasındaki uzaklık.
  • top
    Tür: System.Double
    Nokta denetim üst kenarını çalışma sayfasının üst kenarı arasındaki uzaklık.

Dönüş Değeri

Tür: Microsoft.Office.Tools.Excel.Controls.CheckedListBox
CheckedListBox Eklenmiştir Denetim ControlCollection örneği.

Kullanım Notu

Visual Basic ve C# programlarında, bu yöntemi ControlCollection türündeki herhangi bir nesne üzerinde örnek yöntemi olarak çağırabilirsiniz. Bu yöntemi çağırmak için örnek yöntemi sözdizimini kullandığınızda, ilk parametreyi yok sayın. Daha fazla bilgi için bkz. Uzantı Yöntemleri (Visual Basic) veya Genişletme Yöntemleri (C# Programlama Kılavuzu).

Özel Durumlar

Exception Koşul
ArgumentNullException

Ad bağımsız değişkeni nullnull başvuru (Visual Basic'te Nothing) veya sıfır uzunlukta.

ControlNameAlreadyExistsException

Aynı ada sahip bir denetim içinde ControlCollection örneği.

Notlar

AddCheckedListBox Yöntemi eklemenize olanak sağlayan CheckedListBox sonuna kadar nesne ControlCollection.Kaldırmak için bir CheckedListBox önceden programlı olarak eklenmiş olan denetim ve Remove yöntemi.

Örnekler

Aşağıdaki kod örneği ekler bir CheckedListBox kontrol çalışma sayfasının en üstüne, iki madde işaretli liste kutusuna ekler ve ardından seçer İlk madde onay kutusu.Çalıştır buradan bu örneği kullanmak için Sheet1 bir belge düzeyinde proje sınıfında.

    Private Sub ExcelAddCheckedListBox()

        Dim CheckedListBox1 As Microsoft.Office.Tools. _
            Excel.Controls.CheckedListBox = Me.Controls. _
            AddCheckedListBox(0, 0, 90, 66.75, _
            "CheckedListBox1")
        CheckedListBox1.Items.Add("First Item")
        CheckedListBox1.Items.Add("Second Item")
        CheckedListBox1.SetItemChecked(0, True)

    End Sub

private void ExcelAddCheckedListBox()
{

    Microsoft.Office.Tools.Excel.Controls.CheckedListBox
        checkedListBox1 = this.Controls.AddCheckedListBox(
        0, 0, 90, 66.75, "checkedListBox1");
    checkedListBox1.Items.Add("First Item");
    checkedListBox1.Items.Add("Second Item");
    checkedListBox1.SetItemChecked(0, true);
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

ControlExtensions Sınıf

AddCheckedListBox Fazla Yük

Microsoft.Office.Tools.Excel Ad Alanı