Desktop Resolution VB6

From Free Knowledge Base- The DUCK Project
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Code Sample:

 Option Explicit

 Private Sub Form_Load()

   doScreenRes
   txtX3.Text = Screen.Width
   txtY3.Text = Screen.Height
   txtX4.Text = Screen.Width / 15
   txtY4.Text = Screen.Height / 15

 End Sub

 Sub doScreenRes()
   Dim intXres As Integer, intYres As Integer
 
   intXres = Me.Width
   intYres = Me.Height

   txtX1.Text = intXres
   txtY1.Text = intYres

   txtX2.Text = intXres / 15
   txtY2.Text = intYres / 15
 
 End Sub


 Private Sub Form_Resize()
   doScreenRes
 End Sub

 Sub doScreenRes()
   Dim intXres As Integer, intYres As Integer

   intXres = Me.ScaleWidth
   intYres = Me.ScaleHeight

   txtX1.Text = intXres
   txtY1.Text = intYres
 
   txtX2.Text = intXres / 15
   txtY2.Text = intYres / 15

 End Sub