Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Visual Basic 2010 on Windows 7 (64Bit)

I have a startup form named Form1.
I have written the following code:

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
        DeskHeight = Screen.PrimaryScreen.Bounds.Height : DeskWidth = Screen.PrimaryScreen.Bounds.Width
        Me.Show()
        Me.Size = New Size(DeskWidth, DeskHeight)
        Dim Location As Point : Location = New System.Drawing.Point(0, 0)
        Me.Location = Location
    End Sub


My problem is that the Windows toolbar on the bottom of the screen as
well as a startup Toolbar on the right hand of my screen (that loads every time I start Windows) cover Form1.

How can I make Form1 find the actual free space on my desktop
and resize so it becomes full screen, (but slightly reduced in size) so it is not covered by the toolbars ?
Posted
Updated 20-Jul-10 23:51pm
v3

It's call "maximizing". Just set the appropriate property for the form.

me.WindowState = FormWindowState.Maximized
 
Share this answer
 
Comments
MJK2010 21-Jul-10 7:30am    
Yes "maximizing gives a solution". But in my case I itend to use Form1 as a MDI parent form and I would
like to know the values of the active screen height and width so I can create two child forms (within Form1) with the correct height because I don't want a vertical scroll bar to appear in the application.
#realJSOP 21-Jul-10 14:01pm    
So just turn the scrollbars off.
Or use:

XML
DeskWidth = Screen.PrimaryScreen.WorkingArea.Width
DeskHeight = Screen.PrimaryScreen.WorkingArea.Height
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900