Partilhar via


Button.Bottom Property

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

Namespace:  Microsoft.Office.Tools.Excel.Controls
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property Bottom As Double
public double Bottom { get; }

Property Value

Type: System.Double
The distance, in points, between the bottom edge of the Button and the top edge of the worksheet.

Remarks

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

The Button.Bottom property uses points, whereas the Control.Bottom property uses pixels.

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 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
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());
}

.NET Framework Security

See Also

Reference

Button Class

Microsoft.Office.Tools.Excel.Controls Namespace