📄 frmfocus.frm
字号:
VERSION 5.00
Begin VB.Form FrmFocus
AutoRedraw = -1 'True
BorderStyle = 1 'Fixed Single
Caption = "Focus"
ClientHeight = 3750
ClientLeft = 45
ClientTop = 330
ClientWidth = 1215
ClipControls = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3750
ScaleWidth = 1215
End
Attribute VB_Name = "FrmFocus"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private X_Center As Single
Private Z_Center As Single
Private Z_Last As Single
Private DigiPotActive As Boolean
Private Radius As Single
Public Sub DrawDig()
Left = Val(GetSetting(App.Title, "Dig", "left", Left))
Top = Val(GetSetting(App.Title, "Dig", "top", Top))
If Left < 0 Then Left = 0 'just make sure app isn't off the screen
If Top < 0 Then Top = 0
If Left > Screen.Width - Me.Width Then Left = Screen.Width - Me.Width
If Top > Screen.Height - Me.Height Then Top = Screen.Height - Me.Height
Me.Left = Left
Me.Top = Top
X_Center = ScaleWidth / 2
Z_Center = ScaleHeight / 2
Z_Last = Z_Center
FillStyle = vbFSSolid
ForeColor = RGB(0, 0, 0)
Radius = ScaleWidth / 2.5
Call DrawCircle(Z_Center)
DrawWidth = 10 ' Set starting pen width.
Visible = True
End Sub
Public Sub Form_Unload(Cancel As Integer)
'save trivial settings
If Me.WindowState = vbDefault Then
Call SaveSetting(App.Title, "Dig", "left", Me.Left)
Call SaveSetting(App.Title, "Dig", "top", Me.Top)
End If
End Sub
Private Sub DrawCircle(Z As Single)
Dim Zd As Single
Dim Z_Speed As Double
DrawWidth = 10 ' Set starting pen width.
' Erase the old Joystick
ForeColor = vbButtonFace
FillColor = vbButtonFace
Circle (X_Center, Z_Last), Radius ' Draw a circle.
Line (X_Center + 100, Z_Center)-(X_Center, Z_Last)
Line -(X_Center - 100, Z_Center)
Line (X_Center, Z_Center)-(X_Center, Z_Last)
' Draw the center of the joystick
ForeColor = RGB(0, 0, 0)
FillColor = RGB(0, 0, 0)
Circle (X_Center, Z_Center), Radius / 2, , , , 0.6 ' Draw a circle.
Zd = Z_Center - Z
Zd = Zd * Zd * Zd
Zd = Zd / (ScaleHeight * ScaleHeight)
If TestControl.PCIBoard Then
Z_Speed = (Z_Center - Z) / 1389
Z_Speed = Z_Speed * TestControl.myFocus.MaximumJoystickSpeed
TestControl.myFocus.MoveAtVelocity (Z_Speed)
Else
Z_Speed = (Z_Center - Z) / 1389
Z_Speed = Z_Speed * TestControl.myFocus.MaximumJoystickSpeed / 100 * TestControl.myFocus.MaxSpeed
TestControl.myFocus.MoveAtVelocity (Z_Speed)
End If
Line (X_Center + 100, Z_Center)-(X_Center, Z)
Line -(X_Center - 100, Z_Center)
Line (X_Center, Z_Center)-(X_Center, Z)
DrawWidth = 3 ' Set starting pen width.
ForeColor = RGB(0, 0, 0)
FillColor = RGB(200, 0, 0)
Circle (X_Center, Z), Radius, , , , 0.6 ' Draw a circle.
Z_Last = Z
End Sub
Private Sub ReadDigipot(Z As Single)
If Z < Radius Then
Z = Radius
End If
If Z > (ScaleHeight - Radius) Then
Z = ScaleHeight - Radius
End If
Call DrawCircle(Z)
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DigiPotActive = True
ReadDigipot Y
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
DigiPotActive = False
ReadDigipot Z_Center
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If DigiPotActive Then
ReadDigipot Y
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -