مشاركة عبر


Button.Visible الخاصية

الحصول على أو تعيين القيمة التي تمثل سواء Buttonهو vهوible.

مساحة الاسم:  Microsoft.Office.Tools.Excel.Controls
التجميع:  Microsoft.Office.Tools.Excel.v4.0.Utilities (في Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

بناء الجملة

'إقرار
Public Property Visible As Boolean
    Get
    Set
public bool Visible { get; set; }

قيمة الخاصية

النوع: System.Boolean
trueإذاButtonهو vهوible؛ otherwهوe،false.

أمثلة

ما يلي تعليمات برمجية في المثال إضافة Buttonعنصر التحكم إلى ورقة عمل ويستخدم Borderخاصية إلى اللون حد أخضر خلية. Clickمعالج حدث من زر يستخدم Visibleخاصية لإخفاء زر، وثم بمطالبة مستخدم باختيار أما إظهار زر، أو السماح بتبقي مخفية.

Th هو المثال هو لتخصيص المستوى مستند.

Private Sub AlterControlAppearance()
    Dim HideButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(Me.Range("B2", "C3"), "HideButton")

    HideButton.Text = "Click to hide"
    HideButton.Border.Color = ColorTranslator.ToOle(Color.Green)
    AddHandler HideButton.Click, AddressOf hideButton_Click
End Sub

Private Sub HideButton_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.Visible = False

    ' Allow the user to make the button visible.
    If DialogResult.Yes = MessageBox.Show( _
        "This sheet contains a hidden control." & _
        " Make it visible?", "Example", MessageBoxButtons.YesNo) Then
        ClickedButton.Visible = True
    End If
End Sub
private void AlterControlAppearance()
{
    Microsoft.Office.Tools.Excel.Controls.Button hideButton =
        this.Controls.AddButton(this.Range["B2", "C3"],
        "hideButton");

    hideButton.Text = "Click to hide";
    hideButton.Border.Color = ColorTranslator.ToOle(Color.Green);
    hideButton.Click += new EventHandler(hideButton_Click);
}

void hideButton_Click(object sender, EventArgs e)
{
    Microsoft.Office.Tools.Excel.Controls.Button clickedButton =
        (Microsoft.Office.Tools.Excel.Controls.Button)sender;
    clickedButton.Visible = false;

    // Allow the user to make the button visible.
    if (DialogResult.Yes ==
        MessageBox.Show("This sheet contains a hidden control." +
        " Make it visible?", "Example", MessageBoxButtons.YesNo))
    {
        clickedButton.Visible = true;
    }
}

أمن NET Framework.

راجع أيضًَا

المرجع

Button الفئة

Button الأعضاء

Microsoft.Office.Tools.Excel.Controls مساحة الاسم