Screen Resolution VB 2005

I think that this has been asked for, but i would like to try again.

I have created my app, but my screen is to big, and when it is run on a third party (My Lecturer's screen) it does not fit. I would like to test the screen resolution and then change it at run-time? Any help?

Comments

  • seancampbellseancampbell Pennsylvania, USA
    Try

    If Screen.width >= 800 then
    'code here
    End If
  • : Try
    :
    : If Screen.width >= 800 then
    : 'code here
    : End If

    It seems that an IMPORT is missing. Am i correct?
  • seancampbellseancampbell Pennsylvania, USA
    sry, try System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width
  • : sry, try System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width

    I changed it to this...

    [code]
    If Screen.PrimaryScreen.WorkingArea.Width < 1000 Then
    msgbox(" The resolution is ...")
    End If
    [/code]

    This works, Thanks
    But how do i set the new resolution?
  • seancampbellseancampbell Pennsylvania, USA
    I'm not sure how to set a new resolution in windows, it is possible that you cannot. I would search google or repost with the subject "How to change the Screen Resolution through Code"
  • : I'm not sure how to set a new resolution in windows, it is possible
    : that you cannot. I would search google or repost with the subject
    : "How to change the Screen Resolution through Code"

    Thanks, I found one , but you have to use DirectX 7.0 or maybe later, but it seems to long, and i think i will have to include it into my code. To heavy, if you know what i mean. Would like to stay light and portable. It is only a task....

    Thanks for you previous help. apreciated!
  • : : I'm not sure how to set a new resolution in windows, it is possible
    : : that you cannot. I would search google or repost with the subject
    : : "How to change the Screen Resolution through Code"
    :
    : Thanks, I found one , but you have to use DirectX 7.0 or maybe
    : later, but it seems to long, and i think i will have to include it
    : into my code. To heavy, if you know what i mean. Would like to
    : stay light and portable. It is only a task....
    :
    : Thanks for you previous help. apreciated!
    :


    I might have the answer. I used the DirectX 7.0 driver that
    comes with VB.NET 2005

    First: Add the Reference to DirectX - and then:
    Imports DxVBLib

    Then;
    Dim dx As New DirectX7
    Dim dd As DirectDraw7

    [code]
    '' Set the screen size bigger, if it is to small
    dd = dx.DirectDrawCreate("")
    If Screen.PrimaryScreen.WorkingArea.Width < 1000 Then
    dd.SetDisplayMode(1152, 864, 16, 0, CONST_DDSDMFLAGS.DDSDM_DEFAULT)'' This last bit can be 0
    End If
    Me.WindowState = FormWindowState.Normal
    Me.WindowState = FormWindowState.Maximized
    Me.Refresh()
    [/code]

    I had to use the 2 Windowstates, to maximize after the change of
    the screen. Maybe there is a better way, Any ideas?

    Thanks again for your help
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories