Check resolution & taskbar height

M

Maurice Mertens

Hi,

I'm building an application in VB.NET that can only be started if the
available desktop space is sufficient. This means that when the user starts
the application it has to check 2 things:

1. Does the screen resolution comply to the minimum resolution?
2. What's the height of the taskbar?


Does anyone know how to do this?



--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering


Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

tel: +31 162 470 534
fax: +31 162 470 502
 
G

Guest

I would do this. Put a label on your form and test this

Dim screen as System.Windows.Forms.Screen =
System.Windows.Forms.Screen.PrimaryScreen.

Label1.Text = screen.WorkingArea.ToString

This will retrun the working area of the screen. You should be able to make
all you decisions off of this. If the task bar is viewable and a normal
height, this will take that into account. For example, if the screen is
1024x768 and the taskbar is at its normal settings, this line will return
1024x740. If the taskbar is hidden it will return 1024x768. If its strechedm
it will adjust and return the results I think you are looking for.

I hope this helps,

Jerel
 
M

Maurice Mertens

Jerel,

thanks for the information.
I also found another way which also works fine (allmost the same):

Dim frmWorkingArea As New Form
Dim rctWorkingarea As New Rectangle

rctWorkingarea = Screen.PrimaryScreen.GetWorkingArea(frmWorkingArea)
frmWorkingArea.Close()

With rctWorkingArea.Width you will get the width, with
rctWorkingArea.Height you will get the height.



I would do this. Put a label on your form and test this

Dim screen as System.Windows.Forms.Screen =
System.Windows.Forms.Screen.PrimaryScreen.

Label1.Text = screen.WorkingArea.ToString

This will retrun the working area of the screen. You should be able to
make all you decisions off of this. If the task bar is viewable and a
normal height, this will take that into account. For example, if the
screen is 1024x768 and the taskbar is at its normal settings, this
line will return 1024x740. If the taskbar is hidden it will return
1024x768. If its strechedm it will adjust and return the results I
think you are looking for.
I hope this helps,

Jerel



--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering


Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

tel: +31 162 470 534
fax: +31 162 470 502
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top