Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Control.Scale Method

Scales the control and any child controls.

Overload List

Scales the control and any child controls to the specified ratio.

[Visual Basic] Overloads Public Sub Scale(Single)
[C#] public void Scale(float);
[C++] public: void Scale(float);
[JScript] public function Scale(float);

Scales the control and any child controls by the specified horizontal and vertical ratios.

[Visual Basic] Overloads Public Sub Scale(Single, Single)
[C#] public void Scale(float, float);
[C++] public: void Scale(float, float);
[JScript] public function Scale(float, float);

Example

[Visual Basic, C#, C++] The following example resizes the child controls of a Form using the Scale method. This example scales the height of each control to 1.5 times its current size while the current width of each control is maintained.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of Scale. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Public Sub ScaleChildControls()
   ' Resize all child controls to 1.5 times their current
   ' height while, maintaining their current width.
   Dim i As Integer
   For i = 0 To (Me.Controls.Count) - 1
      Me.Controls(i).Scale(1F, 1.5F)
   Next i
End Sub 

[C#] 
public void ScaleChildControls()
{
   // Resize all child controls to 1.5 times their current
   // height while, maintaining their current width.
   for(int i = 0; i < this.Controls.Count; i++)
   {
      this.Controls[i].Scale(1.0f, 1.5f);
   }
}

[C++] 
public:
   void ScaleChildControls() {
      // Resize all child controls to 1.5 times their current
      // height while, maintaining their current width.
      for (int i = 0; i < this->Controls->Count; i++) {
         this->Controls->Item[i]->Scale(1.0f, 1.5f);
      }
   }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

Control Class | Control Members | System.Windows.Forms Namespace

Show:
© 2015 Microsoft