' Add a new control to the inner PictureBox.
Private Sub mnuControlsAdd_Click()
Dim ctl As TextBox
Dim prev As TextBox
' Create the control.
m_NumControls = m_NumControls + 1
Set ctl = Controls.Add( _
"VB.TextBox", _
"Text" & Format$(m_NumControls), _
picInner)
' Position the control.
Set prev = Controls("Text" & Format$(m_NumControls - 1))
ctl.Move prev.Left, _
prev.Top + prev.Height + 30, _
prev.Width, prev.Height
ctl.Text = ctl.Name
' Size picInner to hold the control.
picInner.Move 0, 0, _
ctl.Left + ctl.Width + 120, _
ctl.Top + ctl.Height + 120
' Display the control.
ctl.Visible = True
' Rearrange the scroll bars.
ArrangeScrollBars
End Sub
|