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

📄 frmic.frm

📁 Visual Basic 6 大学教程的代码
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmImageCombo 
   Caption         =   "Fig. 11.37: ImageComboBox"
   ClientHeight    =   930
   ClientLeft      =   5715
   ClientTop       =   4935
   ClientWidth     =   4140
   LinkTopic       =   "Form1"
   ScaleHeight     =   930
   ScaleWidth      =   4140
   Begin MSComctlLib.ImageList ilsImageList 
      Left            =   600
      Top             =   480
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   39
      ImageHeight     =   38
      MaskColor       =   12632256
      UseMaskColor    =   0   'False
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   6
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmIC.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmIC.frx":0A42
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmIC.frx":1484
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmIC.frx":1EC6
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmIC.frx":2908
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmIC.frx":334A
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.PictureBox picPicture 
      BorderStyle     =   0  'None
      Height          =   615
      Left            =   3000
      ScaleHeight     =   615
      ScaleWidth      =   735
      TabIndex        =   0
      Top             =   120
      Width           =   735
   End
   Begin MSComctlLib.ImageCombo imgcboIC 
      Height          =   330
      Left            =   240
      TabIndex        =   1
      Top             =   120
      Width           =   2295
      _ExtentX        =   4048
      _ExtentY        =   582
      _Version        =   393216
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
   End
End
Attribute VB_Name = "frmImageCombo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 11.37
' Demonstrating the ImageComboBox
Option Explicit
Option Base 1

Private Sub Form_Load()
   Dim x As Integer           ' Looping variable
   Dim images(6) As String    ' Names of images
   
   ' User cannot modify contents of ImageCombo
   imgcboIC.Locked = True
   
   ' Use images from ImageList ilsImageList
   imgcboIC.ImageList = ilsImageList

   ' Populate ImageComboBox
   For x = 1 To 6
      images(x) = "bird" & x & ".bmp"
      
      ' Specify the index (i.e., x), a name used
      ' for identification (i.e., id1, id2, etc.),
      ' and the displayed name (i.e., images(x))
      Call imgcboIC.ComboItems.Add(x, "id" & x, images(x))
      
      ' Set the items image (i.e., give id1 the image
      ' located in ilsImageList(1))
      imgcboIC.ComboItems("id" & x).Image = x
   Next x
      
   ' Display First ImageCombo item
   imgcboIC.ComboItems.Item("id1").Selected = True
End Sub

Private Sub imgcboIC_Click()
   Dim i As Integer
      
   ' Get the index of the selected item
   i = imgcboIC.SelectedItem.Index
   
   ' Display the picture that is selected
   picPicture.Picture = ilsImageList.ListImages(i).Picture
      
   ' Transfer focus to PictureBox
   picPicture.SetFocus
End Sub

⌨️ 快捷键说明

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