Button.Creator الخاصية
الحصول على القيمة تشير إلى تطبيق الذي Buttonتم تاريخ الإنشاء.
مساحة الاسم: Microsoft.Office.Tools.Excel.Controls
التجميع: Microsoft.Office.Tools.Excel.v4.0.Utilities (في Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
بناء الجملة
'إقرار
Public ReadOnly Property Creator As XlCreator
Get
public XlCreator Creator { get; }
قيمة الخاصية
النوع: Microsoft.Office.Interop.Excel.XlCreator
xlCreatorCode
ملاحظات
لأن Buttonتم إنشاؤه في Microsoft المكتب Excel، تقوم هذه خاصية بإرجاع سلسلة XCEL يكافئ الست عشرية 5843454C الرقم.
أمثلة
يلي تعليمات برمجية في المثال إضافة عنصر Buttonعنصر التحكم إلى ورقة عمل الحالي. Clickمعالج الحدث هذا زر تعرض قيم Creatorو Applicationالخصائص.
Th هو المثال هو لتخصيص المستوى مستند.
Private Sub DisplayCreatorAndApplication()
Dim CreatorButton1 As Microsoft.Office.Tools.Excel.Controls.Button = _
Me.Controls.AddButton(Me.Range("B2", "C3"), "CreatorButton1")
CreatorButton1.Text = "Click to view creator and application"
AddHandler CreatorButton1.Click, AddressOf CreatorButton_Click
End Sub
Private Sub CreatorButton_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)
Dim ApplicationString As String = "The current application is " & _
ClickedButton.Application.Name.ToString()
If ClickedButton.Creator = Excel.XlCreator.xlCreatorCode Then
MsgBox(ApplicationString & ". Created by Microsoft Excel")
Else
MsgBox(ApplicationString & _
". Created by an application other than Microsfot Excel")
End If
End Sub
private void DisplayCreatorAndApplication()
{
Microsoft.Office.Tools.Excel.Controls.Button creatorButton1 =
this.Controls.AddButton(this.Range["B2", "C3"],
"creatorButton1");
creatorButton1.Text = "Click to view creator and application";
creatorButton1.Click += new EventHandler(creatorButton_Click);
}
void creatorButton_Click(object sender, EventArgs e)
{
Microsoft.Office.Tools.Excel.Controls.Button clickedButton =
(Microsoft.Office.Tools.Excel.Controls.Button)sender;
string applicationString = "The current application is " +
clickedButton.Application.Name.ToString();
if (clickedButton.Creator == Excel.XlCreator.xlCreatorCode)
{
MessageBox.Show(applicationString +
". Created by Microsoft Excel");
}
else
{
MessageBox.Show(applicationString +
". Created by an application other than Microsfot Excel");
}
}
أمن NET Framework.
- الثقة الكاملة للمتصل الفوري. يتعذر استخدام هذا العضو بواسطة التعليمات البرمجية الموثوق بها جزئيًا. لمزيد من المعلومات، راجع باستخدام مكتبات من تعليمات برمجية موثوق بها جزئي.