Page 1
Page 2
Page 3
The Options form and its code
Option Explicit
Private Sub Command1_Click()
FrmMain.magnify = (Me.Combo1.Text * 10)
If Check1.Value <> 0 Then
FrmMain.Timer1.Interval = 250
Else
FrmMain.Timer1.Interval = 0
End If
Me.Hide
FrmMain.Show
End Sub
Private Sub Command2_Click()
' kill the app
App.End
End Sub
Private Sub Form_Load()
' center the screen
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Me.Combo1.AddItem "1", 0
Me.Combo1.AddItem "2", 1
Me.Combo1.AddItem "3", 2
Me.Combo1.AddItem "4", 3
Me.Combo1.AddItem "5", 4
Me.Combo1.AddItem "6", 5
Me.Combo1.AddItem "7", 6
Me.Combo1.AddItem "8", 7
Me.Combo1.AddItem "9", 8
FrmMain.magnify = (Me.Combo1.Text * 10)
End Sub
As you can see, there is not a lot here it just contains
a dropdown Combobox, a check box and two command buttons. Depending upon
the value in the Combobox, the magnification value is set. The check box
sets the timer interval to 0 or 250, (on or off). One command button when
clicked will set the FrmMain.magnify value and return to the FrmMain or
lens where a repaint will occur. Since all forms are present and just
hidden you can change the properties quite easily. The other Command button
ends the application.
In the load event you can perform a calculation to get
it to center itself on the screen but that's up to you.
It is here that you may wish to add other options.
Screen resizing.
Please note, that the values in the combo box can
be overwritten using the SIP, (keyboard), to other than what is displayed.
If you make it a negative value the image will shrink. For a real application
you would lock the control to prevent this.
THE WAITCURSOR
And here is a little function used to display the
hourglass. I included it in the program originally but found that I really
didn't need it.
To use:
' before doing something turn the hour glass on
WaitCursor(True)
' do something
' when something is done turn the hourglass off
WaitCursor(False)
Function WaitCursor(bOnOrOff As Boolean) As Long
Dim hcursor As Long
If bOnOrOff = True Then
hcursor = LoadCursor(0, IDC_WAIT)
Else
hcursor = LoadCursor(0, 0)
End If
WaitCursor = SetCursor(hcursor)
End Function
Well that's about it. Have fun, I did.
Previous Page