Aracılığıyla paylaş


Button.Delete Yöntem

Dinamik olarak oluşturulan siler Button çalışma sayfasından 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

Açıklamalar

Bu yöntem yalnızca ile kullanılması gereken bir Button programlı at oluşturulançalışma saati. Bu yöntem çağırırsanız bir özel durum bir Button Tasarım zamanı çalışma sayfasına eklendi

Örnekler

Aşağıdaki kod örneği gösterir bir Button Denetim kendi kullanıcı it. tıklattığında siler Click Olay işleyicisi düğmesini çağrıların Delete yöntemi Sil düğmesine basın.

Bu örnek, bir belge düzeyinde özelleştirme için bulunur.

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ı