共用方式為


SimpleShape.Top 屬性

取得或設定圖形的上邊緣和其容器的工作區左邊緣之間的距離 (以像素為單位)。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
<BrowsableAttribute(False)> _
Public Property Top As Integer
[BrowsableAttribute(false)]
public int Top { get; set; }
[BrowsableAttribute(false)]
public:
property int Top {
    int get ();
    void set (int value);
}
[<BrowsableAttribute(false)>]
member Top : int with get, set
function get Top () : int 
function set Top (value : int)

屬性值

類型:Int32
Int32表示像素,控制項的上邊緣和其容器用戶端區域的上邊緣之間的距離。

備註

Top屬性值相當於y參數Location圖案的屬性值。

若要變更Height和Top屬性值會使Bottom圖形來變更屬性值。

您可以使用Location屬性來變更這兩Left和Top屬性來變更圖形的位置,以單一陳述式。

範例

下列範例示範如何使用Left和Top屬性來變更圖形的位置。 此範例中您需要RectangleShape名 RectangleShape1 為表單上的控制項。

Private Sub RectangleShape1_Click_1() Handles RectangleShape1.Click
    ' Set the left edge.
    RectangleShape1.Left = 10
    ' Set the top edge.
    RectangleShape1.Top = 10
End Sub
private void rectangleShape1_Click_1(System.Object sender, System.EventArgs e)
{
    // Set the left edge.
    rectangleShape1.Left = 10;
    // Set the top edge.
    rectangleShape1.Top = 10;
}

.NET Framework 安全性

請參閱

參考

SimpleShape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

Line 和 Shape 控制項簡介 (Visual Studio)

如何:使用 LineShape 控制項繪製線條 (Visual Studio)

如何:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)