SimpleShape.Size Property
Gets or sets the height and width of the shape.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
'Declaration
<BrowsableAttribute(True)> _
Public Property Size As Size
[BrowsableAttribute(true)]
public Size Size { get; set; }
[BrowsableAttribute(true)]
public:
property Size Size {
Size get ();
void set (Size value);
}
[<BrowsableAttribute(true)>]
member Size : Size with get, set
function get Size () : Size
function set Size (value : Size)
Property Value
Type: Size
The Size that represents the height and width of the shape in pixels.
Remarks
The Width and Height properties represent the width and height of the shape. You can use the Size property to obtain the size of the shape for tasks such as drawing on the surface of the shape.
Because SimpleShape has no non-client area, the ClientSize and Size properties are the same.
Examples
The following example demonstrates how to use the Size property to resize an OvalShape control. This example requires that you have an OvalShape control named OvalShape1 on a form.
Private Sub OvalShape1_Click() Handles OvalShape1.Click
' Declare a Size 20 pixels wider and taller than the current Size.
Dim sz As New System.Drawing.Size(OvalShape1.Width + 20,
OvalShape1.Height + 20)
' Change the Size.
OvalShape1.Size = sz
End Sub
private void ovalShape1_Click(System.Object sender, System.EventArgs e)
{
// Declare a Size 20 pixels wider and taller than the current Size.
System.Drawing.Size sz = new System.Drawing.Size(ovalShape1.Width + 20,
ovalShape1.Height + 20);
// Change the Size.
ovalShape1.Size = sz;
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualBasic.PowerPacks Namespace
Other Resources
Introduction to the Line and Shape Controls (Visual Studio)
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)