⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xipmain.vb

📁 这个是国外大学的项目代码
💻 VB
📖 第 1 页 / 共 5 页
字号:
        Me.cboVerticalDelay.Size = New System.Drawing.Size(128, 21)
        Me.cboVerticalDelay.TabIndex = 6
        '
        'cboHorizontalDelay
        '
        Me.cboHorizontalDelay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboHorizontalDelay.Items.AddRange(New Object() {"0 ns (no delay)", "20 ns (quarter pixel)", "40 ns (half pixel)", "60 ns, (3/4 pixel)", "80 ns (one pixel length)", "100 ns", "120 ns", "140 ns"})
        Me.cboHorizontalDelay.Location = New System.Drawing.Point(176, 240)
        Me.cboHorizontalDelay.Name = "cboHorizontalDelay"
        Me.cboHorizontalDelay.Size = New System.Drawing.Size(128, 21)
        Me.cboHorizontalDelay.TabIndex = 4
        '
        'lblVerticalDelay
        '
        Me.lblVerticalDelay.AutoSize = True
        Me.lblVerticalDelay.Location = New System.Drawing.Point(32, 264)
        Me.lblVerticalDelay.Name = "lblVerticalDelay"
        Me.lblVerticalDelay.Size = New System.Drawing.Size(114, 16)
        Me.lblVerticalDelay.TabIndex = 3
        Me.lblVerticalDelay.Text = "Vertical Timing Delay:"
        '
        'lblHorizontalDelay
        '
        Me.lblHorizontalDelay.AutoSize = True
        Me.lblHorizontalDelay.Location = New System.Drawing.Point(32, 240)
        Me.lblHorizontalDelay.Name = "lblHorizontalDelay"
        Me.lblHorizontalDelay.Size = New System.Drawing.Size(131, 16)
        Me.lblHorizontalDelay.TabIndex = 2
        Me.lblHorizontalDelay.Text = "Horizontal Timing  Delay:"
        '
        'tbpSettings
        '
        Me.tbpSettings.Controls.Add(Me.grpDevice)
        Me.tbpSettings.Location = New System.Drawing.Point(4, 22)
        Me.tbpSettings.Name = "tbpSettings"
        Me.tbpSettings.Size = New System.Drawing.Size(696, 358)
        Me.tbpSettings.TabIndex = 2
        Me.tbpSettings.Text = "Settings"
        '
        'grpDevice
        '
        Me.grpDevice.Controls.Add(Me.btnDevStop)
        Me.grpDevice.Controls.Add(Me.btnDevStart)
        Me.grpDevice.Controls.Add(Me.cboDevice)
        Me.grpDevice.Location = New System.Drawing.Point(252, 127)
        Me.grpDevice.Name = "grpDevice"
        Me.grpDevice.Size = New System.Drawing.Size(192, 104)
        Me.grpDevice.TabIndex = 1
        Me.grpDevice.TabStop = False
        Me.grpDevice.Text = "Connection:"
        '
        'btnDevStop
        '
        Me.btnDevStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnDevStop.Location = New System.Drawing.Point(104, 64)
        Me.btnDevStop.Name = "btnDevStop"
        Me.btnDevStop.Size = New System.Drawing.Size(64, 24)
        Me.btnDevStop.TabIndex = 3
        Me.btnDevStop.Text = "Stop"
        '
        'btnDevStart
        '
        Me.btnDevStart.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnDevStart.Location = New System.Drawing.Point(24, 64)
        Me.btnDevStart.Name = "btnDevStart"
        Me.btnDevStart.Size = New System.Drawing.Size(64, 24)
        Me.btnDevStart.TabIndex = 2
        Me.btnDevStart.Text = "Start"
        '
        'cboDevice
        '
        Me.cboDevice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboDevice.Location = New System.Drawing.Point(24, 32)
        Me.cboDevice.Name = "cboDevice"
        Me.cboDevice.Size = New System.Drawing.Size(144, 21)
        Me.cboDevice.TabIndex = 1
        '
        'tbpLog
        '
        Me.tbpLog.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbpLog.Controls.Add(Me.btnLogClear)
        Me.tbpLog.Controls.Add(Me.txtLog)
        Me.tbpLog.Location = New System.Drawing.Point(4, 22)
        Me.tbpLog.Name = "tbpLog"
        Me.tbpLog.Size = New System.Drawing.Size(696, 358)
        Me.tbpLog.TabIndex = 1
        Me.tbpLog.Text = "Log"
        '
        'btnLogClear
        '
        Me.btnLogClear.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnLogClear.Location = New System.Drawing.Point(8, 8)
        Me.btnLogClear.Name = "btnLogClear"
        Me.btnLogClear.Size = New System.Drawing.Size(56, 23)
        Me.btnLogClear.TabIndex = 1
        Me.btnLogClear.Text = "Clear"
        '
        'txtLog
        '
        Me.txtLog.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtLog.Location = New System.Drawing.Point(8, 40)
        Me.txtLog.Multiline = True
        Me.txtLog.Name = "txtLog"
        Me.txtLog.ReadOnly = True
        Me.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.txtLog.Size = New System.Drawing.Size(680, 312)
        Me.txtLog.TabIndex = 2
        Me.txtLog.Text = ""
        '
        'tbpHelp
        '
        Me.tbpHelp.Controls.Add(Me.rtbHelp)
        Me.tbpHelp.Location = New System.Drawing.Point(4, 22)
        Me.tbpHelp.Name = "tbpHelp"
        Me.tbpHelp.Size = New System.Drawing.Size(696, 358)
        Me.tbpHelp.TabIndex = 3
        Me.tbpHelp.Text = "Help"
        '
        'rtbHelp
        '
        Me.rtbHelp.Location = New System.Drawing.Point(8, 8)
        Me.rtbHelp.Name = "rtbHelp"
        Me.rtbHelp.ReadOnly = True
        Me.rtbHelp.Size = New System.Drawing.Size(680, 344)
        Me.rtbHelp.TabIndex = 0
        Me.rtbHelp.Text = "Failed to open UserManual.rtf "
        '
        'tmrProcess
        '
        Me.tmrProcess.Interval = 500
        '
        'tmrRefresh
        '
        Me.tmrRefresh.Interval = 500
        '
        'frmMain
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(706, 383)
        Me.Controls.Add(Me.tbcMain)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.MaximizeBox = False
        Me.Name = "frmMain"
        Me.Text = "XipSoft"
        Me.tbcMain.ResumeLayout(False)
        Me.tbpMultiprocess.ResumeLayout(False)
        Me.grpPicture.ResumeLayout(False)
        Me.grpDataControl.ResumeLayout(False)
        Me.grpImages.ResumeLayout(False)
        Me.grpProcesses.ResumeLayout(False)
        Me.tbpPWM.ResumeLayout(False)
        Me.grpDisplay.ResumeLayout(False)
        Me.grpPulseTiming.ResumeLayout(False)
        Me.tbpSettings.ResumeLayout(False)
        Me.grpDevice.ResumeLayout(False)
        Me.tbpLog.ResumeLayout(False)
        Me.tbpHelp.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not StartDpc() Then
            MsgBox("Failed to initialize Dpcutil.dll !", MsgBoxStyle.Critical)
            End
        End If

        Dim devlist() As String
        Dim defdev As Integer
        If Not DeviceList(devlist, defdev) Then
            MsgBox("Close all the applications that may use dpcutil.dll," & Chr(13) & Chr(10) & _
                "like ExPort, TransPort...", _
                MsgBoxStyle.Exclamation, _
                "Failed to obtain device list")
            End
        ElseIf devlist.Length = 0 Then
            MsgBox("Please Configure the Connection, found in the " & Chr(13) & Chr(10) & _
                "ExPort program of the Digilent Adept Suite," & Chr(13) & Chr(10) & _
                "by adding the new Communication Module.", MsgBoxStyle.Exclamation, _
                "Device list is empty")
            End
        Else
            cboDevice.Items.Clear()
            cboDevice.Items.AddRange(devlist)
            cboDevice.SelectedIndex = defdev
            If Not OpenInterface() Then
                tbcMain.SelectedIndex = 2
            End If
        End If
        btnBestLook160ns_Click(Nothing, Nothing)
        cboResolution.SelectedIndex = 0
        On Error Resume Next
        rtbHelp.LoadFile("UserManual.rtf")
    End Sub

    Private Sub frmMain_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        StopDpc()
    End Sub

    Private Sub btnImageAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImageAdd.Click
        If lstImage.Items.Count >= 15 Then
            MsgBox("Maximum 15 images allowed!", MsgBoxStyle.Information)
            Exit Sub
        End If
        If dlgOpenImage.ShowDialog(Me) = DialogResult.Cancel Then
            Exit Sub
        End If
        Dim bmp As Drawing.Bitmap
        On Error Resume Next
        bmp = Drawing.Bitmap.FromFile(dlgOpenImage.FileName)
        If IsNothing(bmp) Then
            MsgBox("Image not supported.", MsgBoxStyle.Exclamation, "Image not added")
            Exit Sub
        End If
        If bmp.Width > 2048 Or bmp.Height > 2048 Then
            MsgBox("Picture width or height excedes 2048.", MsgBoxStyle.Information, "Image not added")
            Exit Sub
        End If
        If CheckDataSize(bmp) Then
            MsgBox("Data size would exceede memory capacity.", MsgBoxStyle.Information, "Image not added")
            Exit Sub
        End If
        If cboResolution.SelectedIndex = 0 Then
            If (bmp.Width > 320 Or bmp.Height > 240) Then
                MsgBox("Picture size excedes 320x240.", MsgBoxStyle.Information, "Image will not be displayed")
            End If
        ElseIf bmp.Width > 640 Or bmp.Height > 480 Then
            MsgBox("Picture size excedes 640x480.", MsgBoxStyle.Information, "Image will not be displayed")
        End If
        IMGCOLL.Add(bmp)
        DataChanged()
        lstImage.SelectedIndex = lstImage.Items.Add(dlgOpenImage.FileName)
    End Sub

    Private Sub btnImageRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImageRemove.Click
        If lstImage.SelectedIndex < 0 Then
            Exit Sub
        End If
        For ii As Integer = 1 To PRCCOLL.Count
            If Equals(lstImage.SelectedItem, PRCCOLL.Item(ii).src) Or _
                Equals(lstImage.SelectedItem, PRCCOLL.Item(ii).dest) Then
                If MsgBoxResult.Yes = MsgBox( _
                "In order to remove this image" & Chr(13) & Chr(10) & _
                "the process list has to be reseted." & Chr(13) & Chr(10) & _
                "Continue?", MsgBoxStyle.Question + MsgBoxStyle.YesNo) Then
                    btnProcessClear_Click(Nothing, Nothing)
                Else
                    Exit Sub
                End If
            End If
        Next
        IMGCOLL.Remove(lstImage.SelectedIndex + 1)
        lstImage.Items.RemoveAt(lstImage.SelectedIndex)
        DataChanged()
    End Sub

    Private Sub btnImageReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImageReset.Click
        If lstProcess.Items.Count > 0 Then
            If MsgBoxResult.Yes = MsgBox( _
            "In order to reset the image list" & Chr(13) & Chr(10) & _
            "the process list has to be reseted." & Chr(13) & Chr(10) & _
            "Continue?", MsgBoxStyle.Question + MsgBoxStyle.YesNo) Then
                btnProcessClear_Click(Nothing, Nothing)
            Else
                Exit Sub
            End If
        End If
        lstImage.Items.Clear()
        For tmp As Integer = 1 To IMGCOLL.Count
            IMGCOLL.Remove(1)
        Next
        DataChanged()
    End Sub

    Private Sub btnImageChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImageChange.Click
        If lstImage.SelectedIndex < 0 Then
            Exit Sub
        End If
        For ii As Integer = 1 To PRCCOLL.Count
            If Equals(lstImage.SelectedItem, PRCCOLL.Item(ii).src) Or _
                Equals(lstImage.SelectedItem, PRCCOLL.Item(ii).dest) Then
                If MsgBoxResult.Yes = MsgBox( _
                "In order to change this image" & Chr(13) & Chr(10) & _
                "the process list has to be reseted." & Chr(13) & Chr(10) & _
                "Continue?", MsgBoxStyle.Question + MsgBoxStyle.YesNo) Then
                    btnProcessClear_Click(Nothing, Nothing)
                Else
                    Exit Sub
                End If
            End If
        Next
        If dlgOpenImage.ShowDialog(Me) = DialogResult.Cancel Then
            Exit Sub

⌨️ 快捷键说明

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