Share via


LineShape.Scale Method

Resizes the LineShape control by the specified scaling factor.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
Public Overrides Sub Scale ( _
    factor As SizeF _
)
'Usage
Dim instance As LineShape 
Dim factor As SizeF

instance.Scale(factor)
public override void Scale(
    SizeF factor
)
public:
virtual void Scale(
    SizeF factor
) override
public override function Scale(
    factor : SizeF
)

Parameters

Remarks

The Scale method resizes the control by the specified scaling factor. For example, to resize the control to twice its current size, you would use X and Y scaling factors of 2. To resize the control by a fixed number of pixels, change the X2 and/or Y2 properties.

Examples

The following example demonstrates how to use the Scale method of the LineShape control to scale a line by twice its width and two an a half times its height at run time.

Private Sub LineScale_Load(ByVal sender As System.Object, _
 ByVal e As System.EventArgs) Handles MyBase.Load
    LineShape1.X1 = 0
    LineShape1.Y1 = 0
    LineShape1.X2 = 40
    LineShape1.Y2 = 40
End Sub 
Private Sub Button1_Click(ByVal sender As System.Object, _
 ByVal e As System.EventArgs) Handles Button1.Click
    ScaleMe(2, 2.5)
End Sub 
Private Sub ScaleMe(ByVal x As Single, ByVal y As Single)
    Dim newsize As New SizeF(x, y)
    LineShape1.Scale(newsize)
End Sub
private void LineScale_Load(System.Object sender, System.EventArgs e)
{
    lineShape1.X1 = 0;
    lineShape1.Y1 = 0;
    lineShape1.X2 = 40;
    lineShape1.Y2 = 40;
}
private void Button1_Click(System.Object sender, System.EventArgs e)
{
    ScaleMe(2, 2.5f);
}
private void ScaleMe(float x, float y)
{
    SizeF newsize = new SizeF( x, y);
    lineShape1.Scale(newsize);
}

.NET Framework Security

See Also

Reference

LineShape Class

LineShape Members

Microsoft.VisualBasic.PowerPacks Namespace

ShapeContainer

Shape

Other Resources

How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)

How to: Draw Lines with the LineShape Control (Visual Studio)

Introduction to the Line and Shape Controls (Visual Studio)