test.frm

来自「电动平台, 控制X,Y,Z轴移动,能计数」· FRM 代码 · 共 1,934 行 · 第 1/4 页

FRM
1,934
字号
         Caption         =   "Joy X Reverse"
      End
      Begin VB.Menu MnuJoyYRev 
         Caption         =   "Joy Y Reverse"
      End
      Begin VB.Menu mnu5 
         Caption         =   "-"
      End
      Begin VB.Menu mnuHostXReverse 
         Caption         =   "Host X Reverse"
      End
      Begin VB.Menu mnuHostYReverse 
         Caption         =   "Host Y Reverse"
      End
      Begin VB.Menu mnuHostZReverse 
         Caption         =   "Host Z Reverse"
      End
   End
   Begin VB.Menu MnuBaklash 
      Caption         =   "BackLash"
      Begin VB.Menu MnuStageBackLashDistance 
         Caption         =   "Stage Host Backlash Distance"
      End
      Begin VB.Menu MnuStageBacklashEnable 
         Caption         =   "Stage Host Backlash Enable"
      End
      Begin VB.Menu MnuBack1 
         Caption         =   "-"
      End
      Begin VB.Menu MnuStageJoyBackDist 
         Caption         =   "Stage Joy Backlash Distance"
      End
      Begin VB.Menu MnuStageJoyBackEnable 
         Caption         =   "Stage Joy Backlash Enable"
      End
      Begin VB.Menu s3 
         Caption         =   "-"
      End
      Begin VB.Menu MnuFocusBacklashDist 
         Caption         =   "Focus Host Backlash Distance"
      End
      Begin VB.Menu MnuFocusBackLashEnable 
         Caption         =   "Focus Host Backlash Enable"
      End
      Begin VB.Menu s4 
         Caption         =   "-"
      End
      Begin VB.Menu MnuFocusJoyBackDist 
         Caption         =   "Focus Joy Backlash Distance"
      End
      Begin VB.Menu MnuFocusJoyBackEnable 
         Caption         =   "Focus Joy Backlash Enable"
      End
   End
   Begin VB.Menu MnuEncoders 
      Caption         =   "Encoders"
      Begin VB.Menu MnuStageEncEnable 
         Caption         =   "Stage Encoders Enable"
      End
      Begin VB.Menu mnuStageEncoderWindow 
         Caption         =   "Stage Encoder Window"
      End
      Begin VB.Menu mnuStageServo 
         Caption         =   "Stage Servo Enable"
      End
      Begin VB.Menu mnuStageServoWindow 
         Caption         =   "Stage Servo Window"
      End
      Begin VB.Menu mnu6 
         Caption         =   "-"
      End
      Begin VB.Menu MnuFocusEncEnable 
         Caption         =   "Focus Encoder Enable"
      End
      Begin VB.Menu mnuFocusEncoderWindow 
         Caption         =   "Focus Encoder Window"
      End
      Begin VB.Menu MnuFocusServoEnable 
         Caption         =   "Focus Servo Enable"
      End
      Begin VB.Menu mnuZServoWindow 
         Caption         =   "Focus Servo Window"
      End
      Begin VB.Menu MnuEncSpace1 
         Caption         =   "-"
      End
      Begin VB.Menu mnuXres 
         Caption         =   "X Resolution"
      End
      Begin VB.Menu MnuYres 
         Caption         =   "Y Resolution"
      End
      Begin VB.Menu MnuZres 
         Caption         =   "Z Resolution"
      End
      Begin VB.Menu MnuEncSpace2 
         Caption         =   "-"
      End
      Begin VB.Menu MnuX_Index 
         Caption         =   "Find X Index"
      End
      Begin VB.Menu MnuY_Index 
         Caption         =   "Find Y Index"
      End
      Begin VB.Menu MnuZ_Index 
         Caption         =   "Find Z Index"
      End
   End
   Begin VB.Menu MnuReference 
      Caption         =   "Reference"
      Begin VB.Menu MnuSetStageRef 
         Caption         =   "Set Index Stage"
      End
      Begin VB.Menu MnuRestoreStageRef 
         Caption         =   "Restore Index Stage"
      End
      Begin VB.Menu mnuref1 
         Caption         =   "-"
      End
      Begin VB.Menu MnuSetFocusRef 
         Caption         =   "Set Index Z"
      End
      Begin VB.Menu MnuRestoreFocusRef 
         Caption         =   "Restore Index Z"
      End
   End
   Begin VB.Menu mnuCorrection 
      Caption         =   "Correction"
      Begin VB.Menu mnuMapping 
         Caption         =   "Full Stage Mapping"
      End
      Begin VB.Menu mnu4Point 
         Caption         =   "4-Point Stage Correction"
      End
      Begin VB.Menu mnuSkewEnabled 
         Caption         =   "Skew Correction"
      End
      Begin VB.Menu mnuSkewAngle 
         Caption         =   "Skew Angle"
      End
      Begin VB.Menu mnuSkewAbout 
         Caption         =   "Skew About"
      End
      Begin VB.Menu mnuSkewSecond 
         Caption         =   "Skew Second"
      End
   End
   Begin VB.Menu mnuStage 
      Caption         =   "Stage"
   End
   Begin VB.Menu mnuPiezo 
      Caption         =   "Piezo"
   End
   Begin VB.Menu mnuTTL 
      Caption         =   "TTL"
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "Help"
      Begin VB.Menu mnuPriorHelp 
         Caption         =   "Prior DLL"
      End
      Begin VB.Menu mnuHelp1 
         Caption         =   "-"
      End
      Begin VB.Menu MnuAbout 
         Caption         =   "About Prior Test Control"
      End
   End
End
Attribute VB_Name = "TestControl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public myScan As Scan
Public myEncoder As Encoders
Public myStage As Stage
Public myFocus As Z
Public myFilter As Filter
Public myPiezo As Piezo
Public myTTL As TTL

Dim Axes As Byte
Public PCIBoard As Boolean
Dim MySettings As Variant
Dim XMoveDistance As Double
Dim YMoveDistance As Double
Dim ZMoveDistance As Double
Dim TemperatureCount As Integer
Public JoySpeed As Long
Public FocusSpeed As Long
Public WhichFilter As Long
Public ShuttersFilters As Integer


Private Sub btnGoto_Click()
    If frmGoto.Visible = False Then
        frmGoto.Top = TestControl.Top + 400
        frmGoto.Left = TestControl.Left + 240
        frmGoto.Xtarget.SelLength = Len(frmGoto.Xtarget.Text)
        frmGoto.Ytarget.SelLength = Len(frmGoto.Ytarget.Text)
        frmGoto.Ztarget.SelLength = Len(frmGoto.Ztarget.Text)
        frmGoto.Visible = True
        btnGoto.Enabled = False
    End If
End Sub



Private Sub Command2_Click()
    myStage.MoveAtVelocity 1000, 1000
End Sub

Private Sub chkShutters_Click()
    If chkShutters.value = Checked Then
        myFilter.CloseShutterDuringMove = 1
    Else
        myFilter.CloseShutterDuringMove = 0
    End If
End Sub

Private Sub mnu4Point_Click()
    If mnu4Point.Checked = True Then
        myStage.CorrectionEnable = 0
    Else
        myStage.CorrectionEnable = 1
    End If

    SetupCorrection
End Sub

Private Sub mnuFocusEncoderWindow_Click()
   temp = InputBox("Enter Focus Encoder Window in Encoder Counts", _
        "Focus Encoder", myEncoder.ZEncoderWindow)
    If IsNumeric(temp) Then
        myEncoder.ZEncoderWindow = temp
    End If
End Sub

Private Sub mnuHostXReverse_Click()
  If mnuHostXReverse.Checked Then
        myStage.XHostDirection = 1
        mnuHostXReverse.Checked = False
    Else
        myStage.XHostDirection = -1
        mnuHostXReverse.Checked = True
    End If
End Sub
Private Sub mnuHostYReverse_Click()
    If mnuHostYReverse.Checked Then
        myStage.YHostDirection = 1
        mnuHostYReverse.Checked = False
    Else
        myStage.YHostDirection = -1
        mnuHostYReverse.Checked = True
    End If
End Sub

Private Sub mnuHostZReverse_Click()
    If mnuHostZReverse.Checked Then
        myFocus.HostDirection = 1
        mnuHostZReverse.Checked = False
    Else
        myFocus.HostDirection = -1
        mnuHostZReverse.Checked = True
    End If
End Sub


Private Sub mnuMapping_Click()
    If mnuMapping.Checked = True Then
        myStage.MappingEnabled = 0
    Else
        myStage.MappingEnabled = 1
    End If

    SetupCorrection
End Sub

Private Sub mnuPiezo_Click()
    Dim response
    Dim temp
    Dim port As Long
    
    If (myPiezo.IsFitted) Then
        frmPiezo.Show
    Else
        response = MsgBox("Not found, is it on another comm port?", vbYesNo)
        
        If response = vbYes Then
            temp = InputBox("Input Piezo comm port#", "port")
            
            If IsNumeric(temp) Then
                port = temp
                myPiezo.UseCommPort port
                
                If port > 0 Then
                    frmPiezo.Show
                Else
                    MsgBox "Connection Failed Error " & port
                End If
            End If
        End If
    End If
End Sub

Private Sub mnuPriorHelp_Click()
    SendKeys "{F1}"
End Sub

Private Sub mnuSkewAbout_Click()
    myStage.SkewAbout
End Sub

Private Sub mnuSkewAngle_Click()

temp = InputBox("Enter Skew angle in degrees", _
        "Skew Angle", myStage.SkewAngle)
    If IsNumeric(temp) Then myStage.SkewAngle = temp
End Sub

Private Sub mnuSkewEnabled_Click()

    If mnuSkewEnabled.Checked = True Then
        myStage.SkewEnabled = 0
    Else
        myStage.SkewEnabled = 1
    End If
     
    SetupCorrection
End Sub

Private Sub mnuSkewSecond_Click()
    myStage.SkewSecond
    
    SetupCorrection
End Sub
Private Sub mnuCorrection_Click()
    SetupCorrection
End Sub
Private Sub mnuEncoders_Click()
    SetUpEncoders
End Sub
Private Sub MnuBaklash_Click()
    SetupBacklash
End Sub

Private Sub MnuSpeed_Click()
    SetupSpeed
End Sub


Private Sub GetMoveDistance(Index As Integer)
    Dim temp As Variant

    Select Case Index
        Case 0
            temp = InputBox("Please enter the new step size ", "X step Size", XMoveDistance)
            If IsNumeric(temp) <> True Then Exit Sub
            XMoveDistance = temp
            SaveSetting App.Title, "Distance", "X", XMoveDistance
        Case 1
            temp = InputBox("Please enter the new step size ", "Y step Size", YMoveDistance)
            If IsNumeric(temp) <> True Then Exit Sub
            YMoveDistance = temp
            SaveSetting App.Title, "Distance", "Y", YMoveDistance
        Case 2
            temp = InputBox("Please enter the new step size ", "Z step Size", ZMoveDistance)
            If IsNumeric(temp) <> True Then Exit Sub
            ZMoveDistance = temp
            SaveSetting App.Title, "Distance", "Z", ZMoveDistance
    End Select
End Sub
Private Sub BtnBack_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    CmdYFilter.Visible = False
    If Button = vbLeftButton Then
        myStage.MoveBack YMoveDistance
    ElseIf Button = vbRightButton Then
        GetMoveDistance (1)
    End If
End Sub
Private Sub BtnBackLeft_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    CmdYFilter.Visible = False
    If Button = vbLeftButton Then
        myStage.MoveRelative -XMoveDistance, -YMoveDistance
    ElseIf Button = vbRightButton Then
        GetMoveDistance (0)
        GetMoveDistance (1)
    End If
End Sub

Private Sub BtnBackRight_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    CmdYFilter.Visible = False
    If Button = vbLeftButton Then
        myStage.MoveRelative XMoveDistance, -YMoveDistance
    ElseIf Button = vbRightButton Then
        GetMoveDistance (0)
        GetMoveDistance (1)
    End If
End Sub

Private Sub BtnDown_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

   CmdYFilter.Visible = False
    If Button = vbLeftButton Then
        myFocus.MoveDown ZMoveDistance
    ElseIf Button = vbRightButton Then
        GetMoveDistance (2)
    End If
    
  
End Sub



Private Sub BtnForward_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    CmdYFilter.Visible = False
    If Button = vbLeftButton Then
        myStage.MoveForward YMoveDistance
    ElseIf Button = vbRightButton Then
        GetMoveDistance (1)
    End If
End Sub

Private Sub BtnForwardLeft_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    CmdYFilter.Visible = False
    If Button = vbLeftButton Then
        myStage.MoveRelative -XMoveDistance, YMoveDistance
    ElseIf Button = vbRightButton Then
        GetMoveDistance (0)
        GetMoveDistance (1)
    End If
End Sub

Private Sub BtnForwardRight_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    CmdYFilter.Visible = False
    If Button = vbLeftButton Then
        myStage.MoveRelative XMoveDistance, YMoveDistance
    ElseIf Button = vbRightButton Then
        GetMoveDistance (0)
        GetMoveDistance (1)
    End If
End Sub
Private Sub BtnFW1_Click()
    FormFilter.Show
End Sub
Private Sub BtnFW2_Click()
    FormFilter2.Show
End Sub

Private Sub BtnFW3_Click()
    FormFilter3.Show
End Sub

Private Sub BtnGoToZero_Click()
    myScan.MoveXYZtoAbsolute 0, 0, 0
End Sub
Private Sub BtnJoyStick_Click()
    
    
    If PCIBoard Then
        JoySpeed = myStage.MaximumJoystickSpeed
    Else
        'for proscan,MaximumJoystickSpeed returns 0-100% range
       JoySpeed = myStage.MaximumJoystickSpeed / 100 * myStage.MaxSpeed
    End If
    
    FormJoyStick.DrawJoy
    FrmFocus.DrawDig
End Sub

Private Sub BtnLeft_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
        myStage.MoveLeft XMoveDistance
    ElseIf Button = vbRightButton Then
        GetMoveDistance (0)
    End If
End Sub

Private Sub BtnPattern_Click()
    Dim Xpos As Double
    Dim Ypos As Double
    
    myStage.GetPosition Xpos, Ypos

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?