共用方式為


SimpleShape.Width 屬性

取得或設定圖案的寬度。

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

語法

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

屬性值

型別:System.Int32
像素為單位圖案的寬度。

備註

所做的變更Width和Left屬性值的原因Right的圖形來變更屬性值。

您可以使用Size屬性來變更這兩Height和Width屬性,或是使用SetBounds方法,以變更圖形的大小和位置,在單一陳述式。

範例

下列範例會示範如何使用Height和Width屬性,以變更圖形的大小。這個範例要求您必須OvalShape控制項的表單上命名為 OvalShape1。

Private Sub OvalShape1_Click() Handles OvalShape1.Click
    ' Set the height.
    OvalShape1.Height = OvalShape1.Height + 50
    ' Set the width the same as the height to make it a circle.
    OvalShape1.Width = OvalShape1.Height
End Sub
private void ovalShape1_Click(System.Object sender, System.EventArgs e)
{
    // Set the height.
    ovalShape1.Height = ovalShape1.Height + 50;
    // Set the width the same as the height to make it a circle.
    ovalShape1.Width = ovalShape1.Height;
}

.NET Framework 安全性

請參閱

參考

SimpleShape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

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

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

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