Button.Delete أسلوب
حذف حيوي تم إنشاؤه Buttonمن ورقة عمل و إلى إزالته من ControlCollection.
مساحة الاسم: Microsoft.Office.Tools.Excel.Controls
التجميع: Microsoft.Office.Tools.Excel.v4.0.Utilities (في Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
بناء الجملة
'إقرار
Public Function Delete As Object
public Object Delete()
القيمة المُرجعة
النوع: System.Object
ملاحظات
Th هو أسلوب يستخدم فقط مع Buttonالتي هو إنشاؤها بشكل برمجي في وقت التشغيل. استثناء هو طرح حالة الاتصال th هو الأسلوب تشغيل Buttonالتي هو إضافة إلى ورقة عمل في وقت التصميم.
أمثلة
يلي تعليمات برمجية يوضح المثال Buttonعنصر التحكم الذي ينسخ نفسه إلى "حافظة" عند نقر مستخدم فوق it. Clickحدث معالج زر المكالمات الخاصة CopyPictureأسلوب نسخ الزر إلى حافظة كصورة نقطية. معالج الأحداث أيضا بمطالبة مستخدم بتحديد ما إذا كان الأصل زر يجب تم الحذفها بواسطة استدعاء Deleteالأسلوب.
Th هو المثال هو لتخصيص المستوى مستند.
Private Sub CopyControlAsPicture()
Dim CopyButton As Microsoft.Office.Tools.Excel.Controls.Button = _
Me.Controls.AddButton(Me.Range("B2", "D3"), "CopyButton")
CopyButton.Text = "Click to copy this control"
AddHandler CopyButton.Click, AddressOf copyButtonPicture_Click
End Sub
Private Sub CopyButtonPicture_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)
If False = CBool( _
ClickedButton.CopyPicture(Excel.XlPictureAppearance.xlScreen, _
Excel.XlCopyPictureFormat.xlBitmap)) Then
MsgBox("CopyPicture failed")
End If
End Sub
private void CopyControlAsPicture()
{
Microsoft.Office.Tools.Excel.Controls.Button copyButton =
this.Controls.AddButton(this.Range["B2", "D3"],
"copyButton");
copyButton.Text = "Click to copy this control";
copyButton.Click += new EventHandler(copyButtonPicture_Click);
}
void copyButtonPicture_Click(object sender, EventArgs e)
{
Microsoft.Office.Tools.Excel.Controls.Button clickedButton =
(Microsoft.Office.Tools.Excel.Controls.Button)sender;
if (false == (bool)clickedButton.CopyPicture(
Excel.XlPictureAppearance.xlScreen,
Excel.XlCopyPictureFormat.xlBitmap))
{
MessageBox.Show("CopyPicture failed");
}
}
أمن NET Framework.
- الثقة الكاملة للمتصل الفوري. يتعذر استخدام هذا العضو بواسطة التعليمات البرمجية الموثوق بها جزئيًا. لمزيد من المعلومات، راجع باستخدام مكتبات من تعليمات برمجية موثوق بها جزئي.