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配置文件 ...
随机推荐
- Syntactic_sugar
https://en.wikipedia.org/wiki/Syntactic_sugar http://stackoverflow.com/questions/11366006/mysql-on-v ...
- Java Map遍历方式的选择
[原文] 1. 阐述 对于Java中Map的遍历方式,很多文章都推荐使用entrySet,认为其比keySet的效率高很多.理由是:entrySet方法一次拿到所有key和value的集合:而keyS ...
- javascrpt 继承
一.基于原型链方式实现的继承 缺点:无法从子类中调用父类的构造函数,所以没有办法把子类的属性赋值到父类中. 如果父类中有引用类型,例如:数组.此时这个引用类型会添加到子类的原型当中,一但子类某个对象修 ...
- ubuntu如何开启root,如何启用Ubuntu中root帐号
jingyan.baidu.com/article/495ba84116104238b20ede62.html ubuntu如何开启root,如何启用Ubuntu中root帐号 | 浏览:8344 | ...
- IE 的resize事件问题
window的resize事件,真的让人无语! 我在动态设置元素的HTML内容后,窗口高度变化了,可是却不触发resize事件. 但是我在访问document.documentElement.scro ...
- BLE Device Monitor的使用
1 综述 BLE Device Monitor是一个用来显示任意蓝牙低功耗设备服务(services).特征(characteristics).属性(attributes)的windows程序.除了测 ...
- Prism&MEF构建开发框架 (一)
Shell框架XECA shell.xaml主要起到是一个容器或壳的作用 <Window x:Class="XECA.Shell" xmlns="http ...
- 借用layer让弹层不限制在iframe内部
使用方法: 1 除了layer的success,end,cancel回掉函数以外其它的layer参数都可以使用. 2 使用前在layer的js后边把该js引入(可以命名为layerExtend). 3 ...
- Round and Round We Go
http://acm.hdu.edu.cn/showproblem.php?pid=1313 考查大整数与小整数相乘 #include<iostream> #include<cstd ...
- asp.net mvc 简单搜索功能
View中代码: <input type="text" class="searchText" id="searchText"/> ...