I have Windows 7 with Visual Basic 2010.
In my application I have a parent form named: Form1
that hosts two Child forms: Child1Form1 and ChildForm2
I have written the following code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DeskHeight As Integer : Dim DeskWidth As Integer
DeskWidth = Screen.PrimaryScreen.WorkingArea.Width
DeskHeight = Screen.PrimaryScreen.WorkingArea.Height
Me.Show()
Me.Size = New Size(DeskWidth, DeskHeight)
Dim Location As Point : Location = New System.Drawing.Point(0, 0)
Me.Location = Location
Location = New System.Drawing.Point(0, 0)
Me.Location = Location
ChildForm2.MdiParent = Me
Childform2.Location = New Point(175, 0)
Childform2.Show()
Dim ChildForm2Width, ChildForm2Height As Integer
ChildForm2Width = DeskWidth - 175
Childform2.Size = New Size(ChildForm2Width, DeskHeight)
Location = New System.Drawing.Point(175, 0)
Childform2.Location = Location
ChildForm2.Text = "Child2"
ChildForm1.MdiParent = Me
Childform1.Show()
Childform1.Size = New Size(175, DeskHeight)
Location = New System.Drawing.Point(0, 0)
Childform1.Location = Location
End Sub
End Class
My problem is how to make the two child forms fit inside Form1.
If Childform1 has a width of 175 as I set, then Childform2 width
should be:
Deskwidth-175
But this does'nt work. The working area for the child forms is smaller.
I have the same problem for the height of the child forms.
How can I calculate the working area (height -width) of the child forms so no scroll bars appeare ?