I have a Project which has a main Form which uses part of the screen as Tab Pages. Then I load other Forms into the Tab Pages. The problem is that the users are using larger screens that the one that I am developing on and I need to increase the size of the loaded Forms to make it easier for them to read. I can make the Controls larger on the Forms but the Form stays the same size, so Controls to the right hand side and down at the bottom are cut off. The enlarged Form is displayed at the top left of the Tab Page, as required. If I then use the Size command to make the Form larger, it does make it larger but moves the Form into roughly the centre of the Tab Page, once again cutting off Controls to the right hand side and down at the bottom.
Does anyone have any idea how I can keep the Form at the top left of the Tab Page?
Using Location = new Point (0,0) has no effect.
Dim frm As New frmCreateQuotation
Display_Form(frm, "Create Quotations")
Private Sub Display_Form(fourm As Form, tekxt As String)
Dim ThisControl As Control, HorizRatio As Single, VertRatio As Single, Iter As Integer 'V2.0.0.01
Dim tabby As New TabPage
tabby.Text = tekxt
TabControl1.Controls.Add(tabby)
TabControl1.SelectedTab = tabby
tabby.AutoScroll = True
tabby.AutoScrollMinSize = New System.Drawing.Size(1000, tabby.Height) 'V1.0.3.03
fourm.TopLevel = False
fourm.Parent = tabby
fourm.FormBorderStyle = Windows.Forms.FormBorderStyle.None
fourm.Anchor = AnchorStyles.Top
HorizRatio = tabby.Width / xaxis 'fourm.Width 'V2.0.0.01
VertRatio = tabby.Height / yaxis 'fourm.Height 'V2.0.0.01
ReDim Preserve ControlInfos(0 To 0)
For Each ThisControl In fourm.Controls
ReDim Preserve ControlInfos(0 To UBound(ControlInfos) + 1)
On Error Resume Next ' hack to bypass controls with no size or position properties
With ControlInfos(UBound(ControlInfos))
.Left = ThisControl.Left
.Top = ThisControl.Top
.Width = ThisControl.Width
.Height = ThisControl.Height
End With
On Error GoTo 0
Next
Iter = 0 'V2.0.0.01 + For Next loop
For Each ThisControl In fourm.Controls
Iter = Iter + 1
On Error Resume Next ' hack to bypass controls
With ThisControl
.Left = ControlInfos(Iter).Left * HorizRatio
.Top = ControlInfos(Iter).Top * VertRatio
.Width = ControlInfos(Iter).Width * HorizRatio
.Height = ControlInfos(Iter).Height * VertRatio
End With
On Error GoTo 0
Next
'fourm.Size = New Size(tabby.Width, tabby.Height) 'V2.0.0.01
fourm.Show()
fourm.Focus()
End Sub