SSaver.Frm
资源名称:ssaver.zip [点击查看]
上传用户:wje666666
上传日期:2007-03-31
资源大小:8k
文件大小:3k
源码类别:
屏幕保护
开发平台:
Visual Basic
- VERSION 4.00
- Begin VB.Form frmScreenSaver
- BackColor = &H00000000&
- BorderStyle = 0 'None
- Caption = "Form1"
- ClientHeight = 5895
- ClientLeft = 1620
- ClientTop = 1935
- ClientWidth = 6690
- ControlBox = 0 'False
- Height = 6300
- Left = 1560
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 393
- ScaleMode = 3 'Pixel
- ScaleWidth = 446
- ShowInTaskbar = 0 'False
- Top = 1590
- Width = 6810
- WindowState = 2 'Maximized
- Begin VB.Timer Timer1
- Interval = 10
- Left = 120
- Top = 240
- End
- Begin VB.Label lblMessage
- AutoSize = -1 'True
- BackColor = &H00000000&
- Caption = "Mind's Screen Saver Example"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 700
- size = 18
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 435
- Left = 2760
- TabIndex = 0
- Top = 2400
- Width = 5220
- End
- End
- Attribute VB_Name = "frmScreenSaver"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Form_Activate()
- 'moves lblMessage off the right side of the screen and centered vertically
- lblMessage.Left = ScaleWidth
- lblMessage.Top = (ScaleHeight - lblMessage.Height) / 2
- End Sub
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
- EndScreenSaver
- End Sub
- Private Sub Form_Load()
- '***Example by Donovan Parks
- '***donopark@awinc.com
- Dim message As String
- 'continues code even if file is not found
- On Error Resume Next
- 'opens file to find user defined message - defined in Setup.frm
- Open "ssaver.msg" For Input As #1
- Line Input #1, message$
- Close #1
- 'changes message
- lblMessage = message$
- End Sub
- Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- EndScreenSaver
- End Sub
- Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- Static OldX As Integer
- Static OldY As Integer
- 'determines if the mouse was moved before and if the movement was large
- 'if so the screen saver is ended
- If (OldX > 0 And OldY > 0) And (Abs(X - OldX) > 3 Or Abs(Y - OldY) > 3) Then
- Call EndScreenSaver
- End If
- 'assigns the current x and y locations to OldX and OldY
- OldX = X
- OldY = Y
- End Sub
- Private Sub Timer1_Timer()
- 'check to see if the Message has moved completely off the left side of the screen
- If lblMessage.Left < (0 - lblMessage.Width) Then
- lblMessage.Left = ScaleWidth
- End If
- 'moves lblMessage to the left
- lblMessage.Left = lblMessage.Left - 10
- End Sub