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

📄 form1.frm

📁 一个讲述使用imagelist 和 tab控件编程的实例
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   7605
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   12300
   LinkTopic       =   "Form1"
   ScaleHeight     =   7605
   ScaleWidth      =   12300
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame1 
      Height          =   2055
      Left            =   6120
      TabIndex        =   19
      Top             =   1920
      Width           =   5775
      Begin VB.PictureBox Picture4 
         Height          =   1455
         Left            =   1560
         ScaleHeight     =   1395
         ScaleWidth      =   2835
         TabIndex        =   20
         Top             =   360
         Width           =   2895
      End
   End
   Begin VB.ComboBox Combo3 
      Height          =   300
      Left            =   9240
      TabIndex        =   18
      Text            =   "Combo3"
      Top             =   4320
      Width           =   1935
   End
   Begin VB.ListBox List1 
      Height          =   1860
      Left            =   6720
      TabIndex        =   17
      Top             =   4200
      Width           =   1695
   End
   Begin VB.CommandButton Command7 
      Caption         =   "Command7"
      Height          =   495
      Left            =   10320
      TabIndex        =   16
      Top             =   5520
      Width           =   1215
   End
   Begin VB.CommandButton Command6 
      Caption         =   "Command6"
      Height          =   495
      Left            =   8880
      TabIndex        =   15
      Top             =   5520
      Width           =   1215
   End
   Begin VB.CommandButton Command5 
      Caption         =   "应用"
      Height          =   495
      Left            =   10320
      TabIndex        =   14
      Top             =   6840
      Width           =   1335
   End
   Begin VB.CommandButton Command4 
      Caption         =   "取消"
      Height          =   495
      Left            =   8640
      TabIndex        =   13
      Top             =   6840
      Width           =   1335
   End
   Begin VB.CommandButton Command3 
      Caption         =   "确定"
      Height          =   495
      Left            =   6960
      TabIndex        =   12
      Top             =   6840
      Width           =   1335
   End
   Begin TabDlg.SSTab SSTab1 
      Height          =   855
      Left            =   6840
      TabIndex        =   11
      Top             =   840
      Width           =   4095
      _ExtentX        =   7223
      _ExtentY        =   1508
      _Version        =   393216
      Tabs            =   5
      TabsPerRow      =   5
      TabHeight       =   520
      TabCaption(0)   =   "Tab 0"
      TabPicture(0)   =   "Form1.frx":0000
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).ControlCount=   0
      TabCaption(1)   =   "Tab 1"
      TabPicture(1)   =   "Form1.frx":001C
      Tab(1).ControlEnabled=   0   'False
      Tab(1).ControlCount=   0
      TabCaption(2)   =   "Tab 2"
      TabPicture(2)   =   "Form1.frx":0038
      Tab(2).ControlEnabled=   0   'False
      Tab(2).ControlCount=   0
      TabCaption(3)   =   "Tab 3"
      Tab(3).ControlEnabled=   0   'False
      Tab(3).ControlCount=   0
      TabCaption(4)   =   "Tab 4"
      Tab(4).ControlEnabled=   0   'False
      Tab(4).ControlCount=   0
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   30
      Left            =   0
      TabIndex        =   10
      Top             =   7575
      Width           =   12300
      _ExtentX        =   21696
      _ExtentY        =   53
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   1
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageCombo ImageCombo1 
      Height          =   315
      Left            =   1440
      TabIndex        =   9
      Top             =   5640
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   556
      _Version        =   393216
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      Text            =   "ImageCombo1"
      ImageList       =   "ImageList1"
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   360
      Top             =   1560
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      MaskColor       =   12632256
      _Version        =   393216
   End
   Begin VB.PictureBox Picture3 
      Height          =   1215
      Left            =   840
      ScaleHeight     =   1155
      ScaleWidth      =   1635
      TabIndex        =   8
      Top             =   3840
      Width           =   1695
   End
   Begin VB.PictureBox Picture2 
      Height          =   975
      Left            =   3360
      ScaleHeight     =   915
      ScaleWidth      =   1155
      TabIndex        =   7
      Top             =   1440
      Width           =   1215
   End
   Begin VB.PictureBox Picture1 
      Height          =   855
      Left            =   960
      ScaleHeight     =   795
      ScaleWidth      =   1035
      TabIndex        =   6
      Top             =   1440
      Width           =   1095
   End
   Begin MSComctlLib.ImageList ImageList3 
      Left            =   240
      Top             =   4200
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      MaskColor       =   12632256
      _Version        =   393216
   End
   Begin VB.ComboBox Combo2 
      Height          =   300
      Left            =   3600
      TabIndex        =   4
      Text            =   "Combo2"
      Top             =   2880
      Width           =   1455
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   480
      TabIndex        =   3
      Text            =   "Combo1"
      Top             =   2880
      Width           =   1455
   End
   Begin MSComctlLib.ImageList ImageList2 
      Left            =   2640
      Top             =   1560
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      MaskColor       =   12632256
      _Version        =   393216
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   495
      Left            =   3480
      TabIndex        =   1
      Top             =   6840
      Width           =   2175
   End
   Begin VB.CommandButton Command1 
      Caption         =   "两图叠加"
      Height          =   495
      Left            =   2880
      TabIndex        =   0
      Top             =   4440
      Width           =   2175
   End
   Begin VB.Line Line1 
      X1              =   5760
      X2              =   5760
      Y1              =   120
      Y2              =   7560
   End
   Begin VB.Label Label2 
      Caption         =   "Label2"
      Height          =   495
      Left            =   2760
      TabIndex        =   5
      Top             =   240
      Width           =   2415
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   240
      Width           =   2415
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Combo1_Click()
    Set Picture1.Picture = ImageList1.ListImages(Combo1.ListIndex + 1).ExtractIcon
       
End Sub

Private Sub Combo2_Click()
    Set Picture2.Picture = ImageList2.ListImages(Combo2.ListIndex + 1).ExtractIcon
       
End Sub

Private Sub Command1_Click()
    Set Picture3.Picture = ImageList1.Overlay(Combo1.ListIndex + 1, Combo2.ListIndex + 1)
End Sub

Private Sub Command2_Click()
    End
End Sub

Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)

End Sub

Private Sub Command4_Click()
    End
End Sub

Private Sub Form_Load()
    Picture1.AutoSize = 1
    Picture2.AutoSize = 1
    Picture3.AutoSize = 1
    Picture1.BackColor = vbWhite
    Picture2.BackColor = vbWhite
    Picture3.BackColor = vbWhite
    Label1.Caption = "选择图片1显示的图片:"
    Label2.Caption = "选择图片2显示的图片:"
    Dim x As ListImage
    Set x = ImageList1.ListImages.Add(, , LoadPicture("c:\picture\11.gif"))
    Set x = ImageList1.ListImages.Add(, , LoadPicture("c:\picture\22.gif"))
    Set x = ImageList1.ListImages.Add(, , LoadPicture("c:\picture\33.gif"))
    Set x = ImageList1.ListImages.Add(, , LoadPicture("c:\picture\44.gif"))
    Dim y As ListImage
    Set y = ImageList2.ListImages.Add(, , LoadPicture("c:\picture\11.gif"))
    Set y = ImageList2.ListImages.Add(, , LoadPicture("c:\picture\22.gif"))
    Set y = ImageList2.ListImages.Add(, , LoadPicture("c:\picture\33.gif"))
    Set y = ImageList2.ListImages.Add(, , LoadPicture("c:\picture\44.gif"))
    
    With Combo1 '''''在一个单一对象或一个用户定义类型上执行一系列的语句
        .AddItem "11"
        .AddItem "22"
        .AddItem "33"
        .AddItem "44"
        
    End With
    
    With Combo2
        .AddItem "11"
        .AddItem "22"
        .AddItem "33"
        .AddItem "44"
    End With
    
    Combo1.ListIndex = 0   ''''''' 显示列表中的第一项。
    Combo2.ListIndex = 0
    
    
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    List1.AddItem ""
    List1.AddItem "bricks"
    List1.AddItem "buttons"
    List1.AddItem "cargo net"
    List1.AddItem "circuits"
    List1.AddItem "tittle"
    List1.AddItem "draw mat"
    List1.AddItem "red blocks"
    List1.AddItem "plus!"
    List1.AddItem "windows98"
    List1.AddItem "安装程序"
    Combo3.Text = "平铺"
    Combo3.AddItem "平铺"
    Combo3.AddItem "拉伸"
    Combo3.AddItem "居中"
    
    SSTab1.Style = 0 '''选中的为粗体
    SSTab1.TabCaption(1) = "方式" ''''返回或设置sstab控件的选项卡的标题
    SSTab1.TabOrientation = ssTabOrientationTop ''''''''选项卡出现在sstab控件的顶部


End Sub


Private Sub SSTab1_Click(previoustab As Integer)
    Select Case SSTab1.Tab
        Case 0
            List1.Clear
            List1.AddItem ""
            List1.AddItem "bricks"
            List1.AddItem "buttons"
            List1.AddItem "cargo net"
            List1.AddItem "circuits"
            List1.AddItem "tittle"
            List1.AddItem "draw mat"
            List1.AddItem "red blocks"
            List1.AddItem "plus!"
            List1.AddItem "windows98"
            List1.AddItem "城堡"
            List1.AddItem "雪松"
            List1.AddItem "安装程序"
            
            Combo3.Clear
            Combo3.Text = "平铺"
            Combo3.AddItem "平铺"
            Combo3.AddItem "拉伸"
            Combo3.AddItem "居中"
            
            Command6.Caption = "设置"
            Command7.Caption = "图案"
        Case 1
            List1.Clear
            List1.AddItem ""
            List1.AddItem "滚动字幕"
            List1.AddItem "三维文字"
            List1.AddItem "三维迷宫"
            List1.AddItem "飞行的window"
            List1.AddItem "三维变形物"
            List1.AddItem "draw mat"
            List1.AddItem "red blocks"
            List1.AddItem "plus!"
            List1.AddItem "windows98"
            List1.AddItem "城堡"
            List1.AddItem "雪松"
            List1.AddItem "安装程序"
            
            Combo3.Clear
            Combo3.Text = "1分钟"
            Combo3.AddItem "2分钟"
            Combo3.AddItem "3分钟"
            Combo3.AddItem "10分钟"
            Combo3.AddItem "居中"
            
            Command6.Caption = "设置"
            Command7.Caption = "预览"
    End Select
            
End Sub

⌨️ 快捷键说明

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