Aracılığıyla paylaş


Button.Border Özellik

Alır bir Border kenarını temsil eden Button.

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 ReadOnly Property Border As Border
    Get
public Border Border { get; }

Özellik Değeri

Tür: Microsoft.Office.Interop.Excel.Border
A Border kenarını temsil eden Button.

Örnekler

Aşağıdaki kod örneği ekler bir Button çalışma ve kullanımları için Denetim Border özelliğine renk kenarlığını hücre yeşil. Click Düğme olayı işleyicisi kullanır Visible düğmesini gizleme özelliği ve düğmesini göster veya gizli kalmasına izin vermek için kullanıcı ister.

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

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 Güvenliği

Ayrıca bkz.

Başvuru

Button Sınıf

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