共用方式為


Button.Bottom Property

Definition

Gets the distance, in points, between the bottom edge of the Button and the top edge of the worksheet.

public:
 property double Bottom { double get(); };
public double Bottom { get; }
member this.Bottom : double
Public ReadOnly Property Bottom As Double

Property Value

The distance, in points, between the bottom edge of the Button and the top edge of the worksheet.

Examples

The following code example adds a Button control over cell B2 of the current worksheet. The Click event handler of the button displays the current values of the Right and Bottom properties of the button. When column B or row 2 is resized at run time, these values change according to the new size of the column or row.

This example is for a document-level customization.

private void DisplayRightAndBottom()
{
    Microsoft.Office.Tools.Excel.Controls.Button pointButton =
        this.Controls.AddButton(this.Range["B2", "C3"],
        "pointButton");
    pointButton.Text = "Click to display location";
    pointButton.Click += new EventHandler(pointButton_Click);
}

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

    MessageBox.Show("Right is: " + clickedButton.Right.ToString() +
        "; Bottom is: " + clickedButton.Bottom.ToString());
}
Private Sub DisplayRightAndBottom()
    Dim PointButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(Me.Range("B2", "C3"), "PointButton")
    PointButton.Text = "Click to display location"
    AddHandler PointButton.Click, AddressOf PointButton_Click
End Sub

Private Sub PointButton_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)

    MsgBox("Right is: " & ClickedButton.Right.ToString() & _
        "; Bottom is: " & ClickedButton.Bottom.ToString())
End Sub

Remarks

The value of this property is equal to the sum of the Top property value and the Height property value.

The Microsoft.Office.Tools.Excel.Controls.Button.Bottom property uses points, whereas the System.Windows.Forms.Control.Bottom property uses pixels.

Applies to