Aracılığıyla paylaş


Button.Delete Yöntem

Dinamik olarak oluşturulan siler Button çalışma ve buradan kaldırır ControlCollection.

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

Sözdizimi

'Bildirim
Public Function Delete As Object
public Object Delete()

Dönüş Değeri

Tür: System.Object

Notlar

Bu yöntem yalnızca birlikte kullanılması gereken bir Button oluşturulan programlı olarak çalışma zamanında.Bu yöntem çağırırsanız bir özel durum bir Button eklenen çalışma sayfasına tasarım zamanında.

Örnekler

Aşağıdaki kod örneği gösteren bir Button denetimi, kullanıcı tıkladığında kendisini siler.Click Olay işleyicisi düğmesini çağrıların Delete düğmeyi silmek için yöntem.

Belge düzeyi özelleştirmesi için örnektir.

Private Sub DeleteControl()
    Dim DeleteButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(25, 75, 80, 30, "DeleteButton")
    DeleteButton.Text = "Click to delete"
    AddHandler DeleteButton.Click, AddressOf DeleteButton_Click
End Sub

' Delete the clicked button.
Private Sub DeleteButton_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim ClickedButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        CType(sender, Microsoft.Office.Tools.Excel.Controls.Button)

    ClickedButton.Delete()
End Sub
        private void DeleteControl()
        {
            Microsoft.Office.Tools.Excel.Controls.Button deleteButton =
                this.Controls.AddButton(25, 75, 80, 30, "deleteButton");
            deleteButton.Text = "Click to delete";
            deleteButton.Click += new EventHandler(deleteButton_Click);
        }

        // Delete the clicked button.
        void deleteButton_Click(object sender, EventArgs e)
        {
            Microsoft.Office.Tools.Excel.Controls.Button clickedButton =
                (Microsoft.Office.Tools.Excel.Controls.Button)sender;

            clickedButton.Delete();
        }

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

Button Sınıf

Microsoft.Office.Tools.Excel.Controls Ad Alanı