home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form MsgWin
- BackColor = &H0080FFFF&
- BorderStyle = 0 'None
- ClientHeight = 1125
- ClientLeft = 2595
- ClientTop = 2910
- ClientWidth = 3855
- ClipControls = 0 'False
- ControlBox = 0 'False
- ForeColor = &H00000000&
- Height = 1650
- KeyPreview = -1 'True
- Left = 2535
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1125
- ScaleWidth = 3855
- Tag = "MsgWin"
- Top = 2445
- Width = 3975
- Begin TextBox Answer
- Height = 285
- Left = 360
- TabIndex = 3
- Text = "Text1"
- Top = 1005
- Visible = 0 'False
- Width = 285
- End
- Begin SSPanel Message
- BackColor = &H0080FFFF&
- BevelOuter = 0 'None
- BevelWidth = 2
- ForeColor = &H00000000&
- Height = 1050
- Left = 0
- Outline = -1 'True
- TabIndex = 0
- Top = 0
- Width = 3855
- Begin TextBox Text1
- Height = 330
- Left = 1500
- TabIndex = 5
- Top = 525
- Visible = 0 'False
- Width = 555
- End
- Begin CommandButton Button2
- Caption = "Command1"
- Height = 480
- Left = 2055
- TabIndex = 2
- Top = 495
- Visible = 0 'False
- Width = 1170
- End
- Begin CommandButton Button1
- BackColor = &H00C0C0C0&
- Caption = "Command1"
- Height = 480
- Left = 540
- TabIndex = 1
- Top = 510
- Visible = 0 'False
- Width = 960
- End
- Begin Label Label
- Alignment = 2 'Center
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Label1"
- Height = 195
- Left = 165
- TabIndex = 4
- Top = 120
- Visible = 0 'False
- Width = 3630
- WordWrap = -1 'True
- End
- End
- Begin Timer Timer1
- Enabled = 0 'False
- Interval = 1500
- Left = 2655
- Top = 630
- End
- Option Explicit
- Sub Button1_Click ()
- Answer.Text = "1"
- MsgWin.Hide
- End Sub
- Sub Button1_GotFocus ()
- Dim x As Integer, y As Long, Text As String
- Dim Text1 As String
- Dim yplus As Integer
- If Button2.Visible = False Then
- yplus = Label.Height
- Message.Alignment = 6
- Label.Caption = Message.Caption
- Message.Caption = ""
- Label.Visible = True
- Message.Height = Label.Height + (yplus * 3) + Button1.Height
- Button1.Top = Label.Height + yplus
- Button2.Top = Button1.Top
- MsgWin.Height = Message.Height + 2
- y = GetTextExtent(MsgWin.hDC, Button1.Caption, Len(Button1.Caption))
- Text = Hex$(y)
- Text = "&h" + Right$(Text, 4)
- x = Val(Text)
- x = (x * Screen.TwipsPerPixelX) * 1.5
- Button1.Width = x
- y = GetTextExtent(MsgWin.hDC, Button2.Caption, Len(Button2.Caption))
- Text = Hex$(y)
- Text = "&h" + Right$(Text, 4)
- x = Val(Text)
- x = (x * Screen.TwipsPerPixelX) * 1.5
- Button2.Width = x
- Button1.Top = Button1.Top + yplus
- Button2.Top = Button2.Top + yplus
- If Button1.Width < Button1.Height Then
- Button1.Width = Button1.Width * 4 / 3
- Button2.Width = Button2.Width * 4 / 3
- End If
- If Button2.Width < Button2.Height Then
- Button2.Width = Button2.Width * 4 / 3
- Button1.Width = Button1.Width * 4 / 3
- End If
- If Button2.Width < Button1.Width Then
- Button2.Width = Button1.Width
- Else
- Button1.Width = Button2.Width
- End If
- If Button2.Caption = "" Then
- Button1.Left = 1925 - (Button1.Width / 2)
- Exit Sub
- End If
- x = 3854 / 3
- Button1.Left = x - (Button1.Width / 2)
- Button2.Left = (x + x) - (Button2.Width / 2)
- If Button2.Left < (Button1.Left + Button1.Width) Then
- Button1.Left = (3854 / 4) - (Button1.Width / 2)
- Button2.Left = (3854 / 2) + Button1.Left
- End If
- Button2.Visible = True
- End If
- End Sub
- Sub Button2_Click ()
- Answer.Text = 2
- MsgWin.Hide
- End Sub
- Sub Form_GotFocus ()
- Dim WinRect As RECT
- Timer1.Enabled = True
- GetWindowRect MsgWin.hWnd, WinRect
- SetCursorPos WinRect.Left + 30, WinRect.Top + 10
- End Sub
- Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
- If Timer1.Enabled = True Then
- Dim Text As String * 256
- GetKeyBoardState (Text)
- Text = Left$(Text, KeyCode - 1) + Chr$(0) + Right$(Text, 256 - KeyCode)
- SetKeyboardState (Text)
- KeyCode = 0
- Timer1.Enabled = False
- Timer1.Interval = 1
- Timer1.Enabled = True
- End If
- End Sub
- Sub Form_Load ()
- Message.Top = 2
- MsgWin.Height = Message.Height + 2
- Message.Left = 2
- MsgWin.Width = Message.Width + 2
- Timer1.Interval = 1500
- End Sub
- Sub Message_Click ()
- If Timer1.Enabled = True Then MsgWin.Hide
- End Sub
- Sub Message_DblClick ()
- If Timer1.Enabled = True Then MsgWin.Hide
- End Sub
- Sub Text1_GotFocus ()
- Dim x As Integer, Text As String
- Dim y As Integer, z As Long
- Text = Text1.Tag
- If Left$(Text, 1) = "A" Then
- If Len(Text) > 1 Then
- x = Val(Right$(Text, Len(Text) - 1))
- Text1.MaxLength = x
- x = (x * 9) / 10
- Text = String$(x, "W")
- z = GetTextExtent(MsgWin.hDC, Text, x)
- Text = Hex$(z)
- Text = "&h" + Right$(Text, 4)
- x = Val(Text) * Screen.TwipsPerPixelX
- If x > MsgWin.Width Then
- Text1.Width = MsgWin.Width - 60
- Else
- Text1.Width = x
- End If
- Text1.Left = (MsgWin.Width - Text1.Width) / 2
- End If
- End If
- If Message.Caption <> "" Then
- x = Label.Height
- Timer1.Enabled = False
- Message.Alignment = 6
- Label.Caption = Message.Caption
- Message.Caption = ""
- Label.Visible = True
- Text1.Top = Label.Height + (x * 2)
- Message.Height = Text1.Top + Text1.Height + 30
- MsgWin.Height = Message.Height + 2
- End If
- End Sub
- Sub Text1_KeyDown (KeyCode As Integer, Shift As Integer)
- If KeyCode = 27 Then
- Text1 = ""
- KeyCode = 0
- MsgWin.Hide
- End If
- End Sub
- Sub Text1_KeyPress (KeyAscii As Integer)
- If KeyAscii = 13 Then
- KeyAscii = 0
- MsgWin.Hide
- Exit Sub
- End If
- If Text1.Tag = "N" Then
- If KeyAscii >= 48 And KeyAscii <= 57 Then Exit Sub
- If KeyAscii = 8 Then Exit Sub
- KeyAscii = 0
- Exit Sub
- End If
- End Sub
- Sub Text1_LostFocus ()
- MsgWin.Hide
- End Sub
- Sub Timer1_Timer ()
- MsgWin.Hide
- End Sub
-