Desktop Resolution VB6

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

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