Customizing Chart Elements > Resizing Forms |
Some applications permit the resizing of a Form object at runtime. This resizing is enabled at design time by setting the form's BorderStyle property to either 2 (Sizable) or 5 (Sizable ToolWindow).
To adjust the size of a Chart2Dobject when the Form object is resized, define a Resize procedure for the form, and adjust the chart's height and width to correspond to the form's height and width. For example, the following Resize procedure is defined by the chlabels demo:
Private Sub Form_Resize()
' Match the graph to the size of the form.
If Width > 700 Then ' Check the width of the window
' This keeps a consistent border around the
' sides of the chart
Chart2D1.Width = Width - 700
Else
' Sets the width to 0 because the window
' is smaller than the size of the chart
Chart2D1.Width = 0
End If
If Height > 1360 Then ' Check the height of the window
' This keeps a consistent border around the
' top and bottom of the chart
Chart2D1.Height = Height - 1360
Else
' Sets the height to 0 because the window is
' smaller than the size of the chart
Chart2D1.Height = 0
End If
End Sub