LineShape.Scale Method (SizeF)
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
public override void Scale(
SizeF factor
)
public:
virtual void Scale(
SizeF factor
) override
override Scale :
factor:SizeF -> unit
Public Overrides Sub Scale (
factor As SizeF
)
Parameters
factor
Type: System.Drawing.SizeFA SizeF structure that contains the X (horizontal) and Y (vertical) scaling factors.
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 and a half times its height at run time.
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);
}
Private Sub LineScale_Load() Handles MyBase.Load
LineShape1.X1 = 0
LineShape1.Y1 = 0
LineShape1.X2 = 40
LineShape1.Y2 = 40
End Sub
Private Sub Button1_Click() 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
See Also
ShapeContainer
Shape
LineShape Class
Microsoft.VisualBasic.PowerPacks Namespace
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)
Return to top