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

📄 frmselectdevice.frm

📁 VB代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmSelectDevice 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "选择设备"
   ClientHeight    =   3540
   ClientLeft      =   36
   ClientTop       =   324
   ClientWidth     =   5808
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3540
   ScaleWidth      =   5808
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton CmdCancel 
      Caption         =   "取消"
      Height          =   492
      Left            =   3720
      TabIndex        =   4
      Top             =   2520
      Width           =   1092
   End
   Begin VB.CommandButton CmdOK 
      Caption         =   "确定"
      Height          =   492
      Left            =   720
      TabIndex        =   3
      Top             =   2520
      Width           =   1092
   End
   Begin VB.ComboBox CmbDeviceNameID 
      Height          =   276
      Left            =   3960
      TabIndex        =   2
      Text            =   "AT89SXX"
      Top             =   720
      Width           =   1572
   End
   Begin VB.ComboBox CmbManufacturID 
      Height          =   276
      Left            =   2280
      TabIndex        =   1
      Text            =   "Atmel"
      Top             =   720
      Width           =   1332
   End
   Begin VB.ComboBox CmbDeviceTypeID 
      Height          =   276
      Left            =   240
      TabIndex        =   0
      Text            =   "单片机"
      Top             =   720
      Width           =   1692
   End
   Begin VB.Label Label3 
      Caption         =   "器件名称"
      Height          =   252
      Left            =   3960
      TabIndex        =   7
      Top             =   360
      Width           =   1092
   End
   Begin VB.Label Label2 
      Caption         =   "厂商名称"
      Height          =   252
      Left            =   2280
      TabIndex        =   6
      Top             =   360
      Width           =   1092
   End
   Begin VB.Label Label1 
      Caption         =   "器件类别"
      Height          =   252
      Left            =   360
      TabIndex        =   5
      Top             =   360
      Width           =   1092
   End
End
Attribute VB_Name = "FrmSelectDevice"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ucSelectDeviceType As Byte
Dim ucSelectDeviceManufacture As Byte
Function FilterDeviceToCmbDeviceName(ByVal ucSelectDeviceType As Byte, ByVal ucSelectDeviceManufacture As Byte) As Byte
    Dim ucFindDeviceCount As Byte
    Dim lCount As Long
    
    FrmSelectDevice.CmbDeviceNameID.Clear
    
    ucFindDeviceCount = 0
    For lCount = 0 To c_MaxProgramDeviceNumber - 1 Step 1
        If ((PGMDeviceLib(lCount).DeviceGroup = ucSelectDeviceType) And (PGMDeviceLib(lCount).DeviceManufacturerID = ucSelectDeviceManufacture)) Then
            FrmSelectDevice.CmbDeviceNameID.AddItem (PGMDeviceLib(lCount).DeviceNameString)
            ucFindDeviceCount = ucFindDeviceCount + 1
        End If
    Next lCount
    
    If (ucFindDeviceCount > 0) Then
        FrmSelectDevice.CmbDeviceNameID.ListIndex = 0
    Else
        FrmSelectDevice.CmbDeviceNameID.ListIndex = -1
    End If
    
    FilterDeviceToCmbDeviceName = ucFindDeviceCount
End Function

Private Sub CmbDeviceTypeID_Click()
   Dim bReturnValue As Byte
    
    ucSelectDeviceType = FrmSelectDevice.CmbDeviceTypeID.ListIndex
    
    bReturnValue = FilterDeviceToCmbDeviceName(ucSelectDeviceType, ucSelectDeviceManufacture)
End Sub

Private Sub CmbManufacturID_Click()
   Dim bReturnValue As Byte
    
    ucSelectDeviceManufacture = FrmSelectDevice.CmbManufacturID.ListIndex
    
    bReturnValue = FilterDeviceToCmbDeviceName(ucSelectDeviceType, ucSelectDeviceManufacture)
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()

    Dim lCount As Long
    For lCount = 0 To c_MaxProgramDeviceNumber - 1 Step 1
        If (CmbDeviceNameID.Text = PGMDeviceLib(lCount).DeviceNameString) Then
            iCurrentDeviceID = PGMDeviceLib(lCount).DeviceCompleteIDNumber
            Exit For
        End If
    Next lCount

    Unload Me
End Sub
'Public Const c_DeviceGroup_MCU = 0
'Public Const c_DeviceGroup_MEM = 1
'Public Const c_DeviceGroup_PLD = 2

'Public Const c_DeviceManufacturerID_Atmel = 0
'Public Const c_DeviceManufacturerID_Winbond = 1
'Public Const c_DeviceManufacturerID_ST = 2
'Public Const c_DeviceManufacturerID_AMD = 3
'Public Const c_DeviceManufacturerID_NS = 4

Private Sub Form_Load()
    Dim lCount As Long
    Dim bReturnValue As Byte
     
    CmbDeviceNameID.Clear
   
    FrmSelectDevice.CmbDeviceTypeID.AddItem "单片机"
    FrmSelectDevice.CmbDeviceTypeID.AddItem "存储器"
    FrmSelectDevice.CmbDeviceTypeID.AddItem "可编程逻辑器件"
    
   
    FrmSelectDevice.CmbManufacturID.AddItem "Atmel"
    FrmSelectDevice.CmbManufacturID.AddItem "Winbond"
    FrmSelectDevice.CmbManufacturID.AddItem "ST"
    FrmSelectDevice.CmbManufacturID.AddItem "AMD"
    FrmSelectDevice.CmbManufacturID.AddItem "NS"
    FrmSelectDevice.CmbManufacturID.AddItem "Philips"

    ucSelectDeviceType = c_DeviceGroup_MCU
    ucSelectDeviceManufacture = c_DeviceManufacturerID_Philips
    FrmSelectDevice.CmbDeviceTypeID.ListIndex = ucSelectDeviceType
    FrmSelectDevice.CmbManufacturID.ListIndex = ucSelectDeviceManufacture
    
End Sub

⌨️ 快捷键说明

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