📄 joystick.frm
字号:
VERSION 5.00
Object = "*\A..\SOURCE\FAST2010.vbp"
Begin VB.Form frmJoystick
BorderStyle = 3 'Fixed Dialog
Caption = "Joystick Demo"
ClientHeight = 2490
ClientLeft = 1575
ClientTop = 2400
ClientWidth = 4035
Icon = "Joystick.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 2490
ScaleWidth = 4035
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.PictureBox picJoystick
BackColor = &H00FFFFFF&
DrawWidth = 5
Height = 1680
Left = 315
ScaleHeight = 1620
ScaleWidth = 1620
TabIndex = 18
Top = 135
Width = 1680
End
Begin VB.Timer Timer1
Interval = 10
Left = 3450
Top = 1965
End
Begin FLWHardware.FWJoystick objJoystick
Left = 3435
Top = 1350
_ExtentX = 820
_ExtentY = 820
End
Begin VB.Label lblButton
Alignment = 2 'Center
BackColor = &H000000FF&
BorderStyle = 1 'Fixed Single
Caption = "Button 1"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000080&
Height = 315
Index = 0
Left = 90
TabIndex = 17
Top = 1980
Width = 1065
End
Begin VB.Label lblButton
Alignment = 2 'Center
BackColor = &H000000FF&
BorderStyle = 1 'Fixed Single
Caption = "Button 2"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000080&
Height = 315
Index = 1
Left = 1215
TabIndex = 16
Top = 1980
Width = 1065
End
Begin VB.Label Label2
Caption = "MaxZ:"
Height = 195
Index = 7
Left = 2520
TabIndex = 15
Top = 1890
Width = 495
End
Begin VB.Label Label2
Caption = "MinZ:"
Height = 195
Index = 6
Left = 2520
TabIndex = 14
Top = 2100
Width = 495
End
Begin VB.Label lblMaxZ
Caption = "0"
ForeColor = &H000000FF&
Height = 195
Left = 3120
TabIndex = 13
Top = 1890
Width = 675
End
Begin VB.Label lblMinZ
Caption = "0"
ForeColor = &H000000FF&
Height = 195
Left = 3120
TabIndex = 12
Top = 2100
Width = 675
End
Begin VB.Label lblMinY
Caption = "0"
ForeColor = &H000000FF&
Height = 195
Left = 3120
TabIndex = 11
Top = 1530
Width = 675
End
Begin VB.Label lblMaxY
Caption = "0"
ForeColor = &H000000FF&
Height = 195
Left = 3120
TabIndex = 10
Top = 1305
Width = 675
End
Begin VB.Label lblMinX
Caption = "0"
ForeColor = &H000000FF&
Height = 195
Left = 3120
TabIndex = 9
Top = 960
Width = 675
End
Begin VB.Label lblMaxX
Caption = "0"
ForeColor = &H000000FF&
Height = 195
Left = 3120
TabIndex = 8
Top = 765
Width = 675
End
Begin VB.Label lblY
Caption = "0"
ForeColor = &H000000FF&
Height = 195
Left = 3120
TabIndex = 7
Top = 390
Width = 675
End
Begin VB.Label lblX
Caption = "0"
ForeColor = &H000000FF&
Height = 195
Left = 3120
TabIndex = 6
Top = 180
Width = 675
End
Begin VB.Label Label2
Caption = "MinY:"
Height = 195
Index = 5
Left = 2520
TabIndex = 5
Top = 1530
Width = 495
End
Begin VB.Label Label2
Caption = "MaxY:"
Height = 195
Index = 4
Left = 2520
TabIndex = 4
Top = 1305
Width = 495
End
Begin VB.Label Label2
Caption = "MinX:"
Height = 195
Index = 3
Left = 2520
TabIndex = 3
Top = 960
Width = 495
End
Begin VB.Label Label2
Caption = "MaxX:"
Height = 195
Index = 2
Left = 2520
TabIndex = 2
Top = 765
Width = 495
End
Begin VB.Label Label2
Caption = "Y:"
Height = 195
Index = 1
Left = 2520
TabIndex = 1
Top = 390
Width = 495
End
Begin VB.Label Label2
Caption = "X:"
Height = 195
Index = 0
Left = 2520
TabIndex = 0
Top = 180
Width = 495
End
End
Attribute VB_Name = "frmJoystick"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
If objJoystick.Attached Then
With objJoystick
Me.Caption = .ProductName
lblMaxX = .MaxX
lblMinX = .MinX
lblMaxY = .MaxY
lblMinY = .MinY
lblMaxZ = .MaxZ
lblMinZ = .MinZ
End With
Else
Call MsgBox("No joystick present")
End If
End Sub
Private Sub Timer1_Timer()
With objJoystick
If .Attached Then
picJoystick.Cls
picJoystick.PSet (picJoystick.Width * ((.x - .MinX) / (.MaxX - .MinX)), _
picJoystick.Height * ((.Y - .MinY) / (.MaxY - .MinY)))
lblX = .x
lblY = .Y
lblButton(0).ForeColor = IIf(.Button(flwJoystickButton1), vbWhite, vbBlack)
lblButton(1).ForeColor = IIf(.Button(flwJoystickButton2), vbWhite, vbBlack)
End If
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -