home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ownrdclb / focus.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-05-17  |  3.4 KB  |  121 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   7125
  5.    ClientLeft      =   4785
  6.    ClientTop       =   2220
  7.    ClientWidth     =   6585
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   7125
  10.    ScaleWidth      =   6585
  11.    Begin VB.ComboBox cboReal 
  12.       Height          =   315
  13.       Left            =   420
  14.       TabIndex        =   6
  15.       Text            =   "Combo1"
  16.       Top             =   360
  17.       Width           =   2655
  18.    End
  19.    Begin VB.CommandButton Command1 
  20.       Caption         =   "Command1"
  21.       Height          =   375
  22.       Left            =   480
  23.       TabIndex        =   5
  24.       Top             =   3360
  25.       Width           =   1395
  26.    End
  27.    Begin VB.PictureBox cboThis 
  28.       Height          =   375
  29.       Index           =   0
  30.       Left            =   420
  31.       ScaleHeight     =   315
  32.       ScaleWidth      =   2595
  33.       TabIndex        =   0
  34.       Top             =   780
  35.       Width           =   2655
  36.    End
  37.    Begin VB.PictureBox cboThis 
  38.       Height          =   375
  39.       Index           =   1
  40.       Left            =   420
  41.       ScaleHeight     =   315
  42.       ScaleWidth      =   2595
  43.       TabIndex        =   1
  44.       Top             =   1260
  45.       Width           =   2655
  46.    End
  47.    Begin VB.PictureBox cboThis 
  48.       Height          =   375
  49.       Index           =   2
  50.       Left            =   420
  51.       ScaleHeight     =   315
  52.       ScaleWidth      =   2595
  53.       TabIndex        =   2
  54.       Top             =   1740
  55.       Width           =   2655
  56.    End
  57.    Begin VB.PictureBox cboThis 
  58.       Height          =   375
  59.       Index           =   3
  60.       Left            =   420
  61.       ScaleHeight     =   315
  62.       ScaleWidth      =   2595
  63.       TabIndex        =   3
  64.       Top             =   2220
  65.       Width           =   2655
  66.    End
  67.    Begin VB.PictureBox cboThis 
  68.       Height          =   375
  69.       Index           =   4
  70.       Left            =   420
  71.       ScaleHeight     =   315
  72.       ScaleWidth      =   2595
  73.       TabIndex        =   4
  74.       Top             =   2700
  75.       Width           =   2655
  76.    End
  77. Attribute VB_Name = "Form1"
  78. Attribute VB_GlobalNameSpace = False
  79. Attribute VB_Creatable = False
  80. Attribute VB_PredeclaredId = True
  81. Attribute VB_Exposed = False
  82. Option Explicit
  83. Private Sub cboReal_KeyPress(KeyAscii As Integer)
  84. If (KeyAscii >= Asc("a") And KeyAscii <= Asc("b")) Then
  85.    KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
  86. End If
  87. End Sub
  88. Private Sub cboThis_KeyPress(Index As Integer, KeyAscii As Integer)
  89. If (KeyAscii >= Asc("a") And KeyAscii <= Asc("b")) Then
  90.    KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
  91. End If
  92. End Sub
  93. Private Sub Command1_Click()
  94. Dim i As Long
  95. Dim lW As Long
  96.     If (cboThis(0).Width = 2655) Then
  97.         lW = Me.ScaleWidth - cboThis(i).Left * 2
  98.     Else
  99.         lW = 2655
  100.     End If
  101.     For i = 0 To cboThis.UBound
  102.         cboThis(i).Width = lW
  103.     Next i
  104. End Sub
  105. Private Sub Form_Load()
  106. Dim i As Integer, l As Long
  107.     For i = 0 To cboThis.UBound
  108.         AddItems cboThis(i)
  109.     Next i
  110.    For l = 1 To 100
  111.       cboReal.AddItem "Item:" & l
  112.    Next l
  113. End Sub
  114. Private Sub AddItems(cboThis As OwnerDrawComboList)
  115. Dim l As Long
  116.     For l = 1 To 100
  117.         cboThis.AddItemAndData "Item:" & l & " & for testing ampersand", , (l Mod 3) * 8
  118.     Next l
  119.     cboThis.ListIndex = 0
  120. End Sub
  121.