本文為機器翻譯文章。如需檢視英文版,請選取 [原文] 核取方塊。您也可以將滑鼠指標移到文字上,即可在快顯視窗顯示英文原文。
譯文
原文

Button.Border 屬性

 

取得 Border,其代表 Button 的邊框。

命名空間:   Microsoft.Office.Tools.Excel.Controls
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public Border Border { get; }

屬性值

Type: Microsoft.Office.Interop.Excel.Border

Border,代表 Button 的邊框。

The following code example adds a Button control to a worksheet and uses the Border property to color the border of the cell green.The Click event handler of the button uses the Visible property to hide the button, and then prompts the user to choose to either unhide the button, or allow it to remain hidden.

This example is for a document-level customization.

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;
    }
}
回到頁首
顯示: