Advertisement
2002C VB function enhancement #10833

Resize a form based on display settings

Resizes a form based on the display settings

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
'Use this sub in the form you are coding, it could be improved to be a global procedure
'and pass the form as an argument.
Private Sub Resizeall()
Dim Ctl As Control
 Dim X As Integer
  
   Dim Size As Double
   ScreenX = GetSystemMetrics(SM_CXSCREEN)

 ScreenY = GetSystemMetrics(SM_CYSCREEN)
  
' this picks out the display settings.
Select Case ScreenX
    Case 640
         'size = 0.67
        Size = 0.64
    Case 800
        Size = 0.72
    Case 1024
        Exit Sub
    Case 1280
      'Exit Sub
      Size = 1.25
    Case Else
      Exit Sub
  End Select
  'Me.Height = Me.Height * size
  'Me.Top = Me.Top * size
  'Me.Width = Me.Width * size
  'Me.Left = Me.Left * size
  For Each Ctl In Me.Controls
  
   Ctl.Height = Ctl.Height * Size
   Ctl.Width = Ctl.Width * Size
   Ctl.Top = Ctl.Top * Size
   Ctl.Left = Ctl.Left * Size
   If TypeOf Ctl Is TextBox Or TypeOf Ctl Is Label Or TypeOf Ctl Is CommandButton Then
   'Ctl.SizeToFit
   Ctl.FontName = "Arial"
   Ctl.FontSize = 6.7
   If TypeOf Ctl Is CommandButton Then
   Ctl.FontName = "Arial"
   Ctl.FontSize = 5
   End If
   End If
  
  'SizeToFit
   
  Next Ctl
  
End Sub
This is the first version of my membership services (Proof of Concept). It allows you to create member accounts on a centralized web server. After this is done, a user can log into any website that offes this service so that they do not have to create new accounts each time that they want to join a site within your network. I like to refer to this as a very lite version of Microsoft Passport. There are plans in the future to impliment security, add validation (via email) and add profiles.
<P>
This service uses the XMLHTTP component that is available on most shared web servers (installed with IE 4.0 and up by default). If you do not have access to this component, or wish to use another one, then you will need to modify the code.
<P>
Ok, the code is here if you are interested and comments a greatly welcomed.
Original Comments (3)
Recovered from Wayback Machine