form1.ebf
来自「windows mobile 应用程序开发实践一书的源代码」· EBF 代码 · 共 113 行
EBF
113 行
VERSION 5.00
Object = "{E491F001-98EC-11D1-9B3D-00C04FAD5AEC}#1.0#0"; "msceimagelist.dll"
Object = "{6556ED95-9838-11D1-80AE-00C04FAD5EFB}#1.0#0"; "mscelistview.dll"
Begin VB.Form Form1
Appearance = 0 'Flat
BackColor = &H00FFC0FF&
Caption = "Form1"
ClientHeight = 3720
ClientLeft = 60
ClientTop = 840
ClientWidth = 4350
ForeColor = &H80000008&
ScaleHeight = 3720
ScaleWidth = 4350
ShowOK = -1 'True
Begin CEImageListCtl.ImageList ImageList2
Left = 1200
Top = 840
_cx = 990
_cy = 990
ImageWidth = 0
ImageHeight = 0
End
Begin CEImageListCtl.ImageList ImageList1
Left = 2760
Top = 2160
_cx = 990
_cy = 990
ImageWidth = 0
ImageHeight = 0
End
Begin MSCELISTVIEWLibCtl.ListViewCtrl ListView1
Height = 3495
Left = 0
TabIndex = 0
Top = 0
Width = 3495
_cx = 6165
_cy = 6165
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8
FontStrikethrough= 0 'False
FontUnderline = 0 'False
HideColumnHeaders= 0 'False
HideSelection = -1 'True
LabelEdit = 0
LabelWrap = 0 'False
MultiSelect = 0 'False
Sorted = 0 'False
SortKey = 0
SortOrder = 0
View = 0
Enabled = -1 'True
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
ListView1.View = lvwIcon '设置为图标视图
Dim clmX As ColumnHeader
'添加 ColumnHeaders。列宽度等于控件的宽度
'除以 ColumnHeader 对象的数目。
Set clmX = ListView1.ColumnHeaders. _
Add(, , "国家", ListView1.Width / 3)
Set clmX = ListView1.ColumnHeaders. _
Add(, , "省", ListView1.Width / 3)
Set clmX = ListView1.ColumnHeaders. _
Add(, , "市", ListView1.Width / 3)
ListView1.View = lvwReport '设置 View 属性为报表型。
ImageList1.Add App.Path & "\a1.bmp"
ListView1.Icons = ImageList1.hImageList
ImageList2.Add App.Path & "\a1.bmp"
ListView1.SmallIcons = ImageList2.hImageList
Dim itmX As ListItem
Dim i As Integer
For i = 0 To 9
Set itmX = ListView1.ListItems.Add(, , "中国" & CStr(i))
itmX.Icon = 1 '设置 ImageList1 中的一个图标。
itmX.SmallIcon = 1 '设置 ImageList2 中的一个图标。
itmX.SubItems(1) = "湖北" & CStr(i * 2 + 1.9) 'Address 字段。
itmX.SubItems(2) = "武汉" & CStr(i * 1.6 + 3) 'Phone 字段。
Next
End Sub
Private Sub Form_OKClick()
App.End
End Sub
Private Sub ListView1_ItemClick(ByVal Index As Long)
Dim intX As Integer
On Error Resume Next '如果整数未输入。
intX = ListView1.SelectedItem.Index
ListView1.ListItems(intX).Selected = True
MsgBox ListView1.ListItems(intX).Text & " 被选择."
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?