Check resolution & taskbar height

  • Thread starter Thread starter Maurice Mertens
  • Start date Start date
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
 
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
 
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
 
Back
Top