Page 1 of 1

find monitor resolution

Posted: Tue Mar 25, 2008 7:00 pm
by mr_penguin
how can I make a button find my monitor's resolution and display it in a label? I'm using VB

Posted: Tue Mar 25, 2008 7:11 pm
by Tural

Code: Select all

    Private Sub btnGetResolution_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetResolution.Click
        Dim X As Integer = Screen.PrimaryScreen.Bounds.Width
        Dim Y As Integer = Screen.PrimaryScreen.Bounds.Height

        lblResolution.Text = "Resolution: " & X & "x" & Y
    End Sub

Posted: Wed Mar 26, 2008 11:34 am
by click16
do you know how to convert an integer to a system.drawing.point ?

Posted: Wed Mar 26, 2008 11:36 am
by Tural
What are you ultimately trying to do?

Posted: Wed Mar 26, 2008 11:44 am
by click16
I'm trying set the location of my app so it works on all resolutions

Posted: Wed Mar 26, 2008 1:24 pm
by Patrickssj6

Code: Select all

Me.Location = New Point (x,y)

Posted: Wed Mar 26, 2008 7:19 pm
by mr_penguin
Thanks, and I see click just asked my second question.