Solved

form to fill the screen,but not cover the taskbar

Posted on 2014-02-01
10
521 Views
Last Modified: 2014-02-02
I have a form I want to fill the whole screen, but not cover the taskbar.
I realize the taskbar could be on the top, bottom or sides.
How to write this ?
0
Comment
Question by:isnoend2001
  • 4
  • 4
  • 2
10 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39827391
Have you tried:

MyForm.WindowState = vbMaximized
0
 

Author Comment

by:isnoend2001
ID: 39827732
Thanks : GrahamSkan, but that still covers the taskbar,
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39827774
Which version of Visual Basic are you using? VB6, VB.Net, VBA?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39827777
Hmm. It doesn't in my tests- Windows 7 (64) and VB6 (sp6)
0
 

Author Comment

by:isnoend2001
ID: 39827790
vb6(sp6)professional on xp
0
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 39827803
I agree with Graham, but this will work too.

Option Explicit

Private Const SPI_GETWORKAREA = 48
Private Declare Function SystemParametersInfo& Lib "User32" Alias "SystemParametersInfoA" ( _
ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As Any, _
ByVal fuWinIni As Long)

Private Type RECT
  Left As Long
  Top As Long
  Right As Long
  Bottom As Long
End Type

Public Function FillScreen(frm As Form)
    Dim rectDesktop As RECT
    Call SystemParametersInfo(SPI_GETWORKAREA, 0, rectDesktop, 0)

    With Form1
        .Left = rectDesktop.Left * Screen.TwipsPerPixelX
        .Height = (rectDesktop.Bottom - rectDesktop.Top) * Screen.TwipsPerPixelY
        .Width = (rectDesktop.Right - rectDesktop.Left) * Screen.TwipsPerPixelX
        .Top = rectDesktop.Top * Screen.TwipsPerPixelY
    End With
End Function

Private Sub Form_Load()
FillScreen Form1
End Sub

Open in new window

0
 

Author Closing Comment

by:isnoend2001
ID: 39827835
Thanks
Guess the benefit of developing on xp has its benefits
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39827856
You're welcome.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39827909
isnoend2001, just out of curiosity, is your form borderless? If it is then that would explain why Graham's suggestion didn't work for you.
0
 

Author Comment

by:isnoend2001
ID: 39827926
No the form is not bordeless, but i plan on making one bordeless to act as a background
for smaller forms. I will post a question for this
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question