TImageList 和 TlistView 组件(C++Builder)
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
//加载图标到Imagelist
Graphics::TBitmap *bmpPicture = NULL;
bmpPicture = new Graphics::TBitmap;
bmpPicture->LoadFromFile(L"File001.bmp");
ImageList1->Add(bmpPicture,bmpPicture); bmpPicture = new Graphics::TBitmap;
bmpPicture->LoadFromFile(L"File002.bmp");
ImageList1->Add(bmpPicture,bmpPicture); bmpPicture = new Graphics::TBitmap;
bmpPicture->LoadFromFile(L"File003.bmp");
ImageList1->Add(bmpPicture,bmpPicture); bmpPicture = new Graphics::TBitmap;
bmpPicture->LoadFromFile(L"File004.bmp");
ImageList1->Add(bmpPicture,bmpPicture); bmpPicture = new Graphics::TBitmap;
bmpPicture->LoadFromFile(L"File005.bmp");
ImageList1->Add(bmpPicture,bmpPicture); bmpPicture = new Graphics::TBitmap;
bmpPicture->LoadFromFile(L"File006.bmp");
ImageList1->Add(bmpPicture,bmpPicture); TListColumn *ListColumn;
TListItem *ListItem;
ListView1->Width = ;
//建立表头信息
ListColumn = ListView1->Columns->Add();
ListColumn->Caption = "姓名";
ListColumn->Width = ; ListColumn = ListView1->Columns->Add();
ListColumn->Caption = "性别";
ListColumn->Width = ; ListColumn = ListView1->Columns->Add();
ListColumn->Caption = "年龄";
ListColumn->Width = ; ListColumn = ListView1->Columns->Add();
ListColumn->Caption = "出生年月";
ListColumn->Width = ; ListColumn = ListView1->Columns->Add();
ListColumn->Caption = "联系方式";
ListColumn->Width = ; const char *sex[]={"男","女"};
//添加信息
ListItem = ListView1->Items->Add();
ListItem->Caption = "李明";
ListItem->ImageIndex = ;
ListItem->SubItems->Add(sex[]);
ListItem->SubItems->Add("");
ListItem->SubItems->Add("1993-04-11");
ListItem->SubItems->Add(""); ListItem = ListView1->Items->Add();
ListItem->Caption = "张静";
ListItem->ImageIndex = ;
ListItem->SubItems->Add(sex[]);
ListItem->SubItems->Add("");
ListItem->SubItems->Add("1991-06-71");
ListItem->SubItems->Add(""); ListItem = ListView1->Items->Add();
ListItem->Caption = "王红";
ListItem->ImageIndex = ;
ListItem->SubItems->Add(sex[]);
ListItem->SubItems->Add("");
ListItem->SubItems->Add("1995-01-10");
ListItem->SubItems->Add(""); ListItem = ListView1->Items->Add();
ListItem->Caption = "孙智铭";
ListItem->ImageIndex = ;
ListItem->SubItems->Add(sex[]);
ListItem->SubItems->Add("");
ListItem->SubItems->Add("1991-06-11");
ListItem->SubItems->Add(""); ListItem = ListView1->Items->Add();
ListItem->Caption = "林夕";
ListItem->ImageIndex = ;
ListItem->SubItems->Add(sex[]);
ListItem->SubItems->Add("");
ListItem->SubItems->Add("1992-02-21");
ListItem->SubItems->Add(""); ListView1->ViewStyle = vsReport;
//ListView1->ViewStyle = vsIcon;
//ListView1->ViewStyle = vsList;
//ListView1->ViewStyle = vsSmallIcon;
ListView1->LargeImages = ImageList1;
ListView1->SmallImages = ImageList1;
}
效果图:

ViewStyle属性改成csIcon的效果:

TImageList 和 TlistView 组件(C++Builder)的更多相关文章
- delphi列表视图组件(TListView)使用方法|实例
TListView 组件以多种形式显示列表的项目,如详细资料.小图标.大图标等形式表示列表中的项目. 列表视图与用TListBox 组件实现的列表框非常相似.不同的是,列表视图可以让用户选择不同 ...
- IoC之AutoFac(一)——简单使用和组件注册
阅读目录 一.AutoFac简单使用 二.注册 2.1 注册方式 2.2 带参数注册 回到顶部 一.AutoFac简单使用 1 namespace AutofacDemo 2 { 3 class Pr ...
- TListView使用方法1(转)
ListView1.Items 为标准 Tlistitems类 ListView1.Items (1)赋值 with ListView1.Items.Add do begin Caption:=cap ...
- Autofac官方文档翻译--一、注册组件--1注册概念
官方文档:http://docs.autofac.org/en/latest/register/registration.html 一.注册概念 使用Autofac 注册组件,通过创建一个Contai ...
- delphi 各版本的特性
delphi 各新版本特性收集 Delphi XE6新增了一些特性并增强了原有的功能,主要有以下几个方面: IDE(整合开发环境) Internet XML(扩展标记语言) Compiler( ...
- Delphi XE5中的新增内容
Delphi XE5中的新增内容 Delphi XE5是所有Delphi开发人员的必须备升级,并且是来自Embarcadero的获奖的.多设备应用开发解决方案的最新版本.使用Delphi XE5的新特 ...
- Objective-C 生成器模式 -- 简单实用和说明
1.生成器模式的定义 将一个复杂的对象的构件与它的表示分离,使得同样的构建过程可以创建不同的表示 2.生成器模式的UML Builder :生成器接口,定义创建一个Product各个部件的操作 Con ...
- Autofac 依赖注入
介绍 Autofac是一款IOC框架,很轻量级性能非常高,自动注入很给力. NuGet Autofac:Autofac控制反转容器核心 Autofac.MVC5:提供IDependencyResolv ...
- Autofac的高级使用——Autofac.2.6.3.862
Autofac的高级使用——Autofac.2.6.3.862 目录(?)[-] 使用代码方式进行组件注册依赖服务类和组件类 使用配置文件进行组件注册不需要依赖 定义配置文件 读取config配置文件 ...
随机推荐
- 不遗留问题-menu数据拼装-2
$res = array(); foreach($idlist_1 as $id1) { $tmp = array(); $tmp1 = array(); $tmp1[] = $id1; foreac ...
- Kafka 0.10.0
2.1 Producer API We encourage all new development to use the new Java producer. This client is produ ...
- this super 解释
关于 this super 什么时候有,他们指向谁? 书上说: this 指向自己,super指向父亲的对象,个人觉得是错误的. 我认为 this 是一个指向自己对象的句柄,而super只是一个类句柄 ...
- myeclipse 8.5 常用快捷键【转】
eclipse 里查找行号的方法 今天开发的时候为了方便查找报错行的位置,特意在网上找了一下快捷键是什么,现做记录. 在Eclipse里的show the line number 后,使用" ...
- 利用select函数的定时返回功能在Windows上实现微秒级的cpu休眠
说明:在调用该函数前要先调用WSAStartup初始化Winsock void uSleep(uint32_t usec) { struct timeval timeout; fd_set fds; ...
- angularJS自定义指令间的“沟通”
由此例子我们可以看出,angularJS使用指令时link的执行顺序<html> <head> <meta charset="utf-8"/> ...
- 设计模式:访问者模式(Visitor)
定 义:表示作用于某对象结构中的各元素的操作.它使你可以在不改变各元素的类的前提下定义作用于这些元素的新操作. 结构图: 示例: . 状态类: //状态的抽象类 abstract class Act ...
- CodeTimer
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using S ...
- Selenium2学习-031-WebUI自动化实战实例-029-JavaScript 在 Selenium 自动化中的应用实例之四(获取元素位置和大小)
通过 JS 或 JQuery 获取到元素后,通过 offsetLeft.offsetTop.offsetWidth.offsetHeight 即可获得元素的位置和大小,非常的简单,直接上源码了,敬请参 ...
- Selenium2学习-010-WebUI自动化实战实例-008-Selenium 操作下拉列表实例-Select
此文主要讲述用 Java 编写 Selenium 自动化测试脚本编写过程中,对下拉列表框 Select 的操作. 下拉列表是 Web UI 自动化测试过程中使用率非常高的,通常有两种形式的下拉列表,一 ...