共用方式為


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)

屬性值

型別:System.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)

HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)

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