ListView 操作
TListItem *Item; for (int i = ; i < ; i++)
{
Item = ListView1->Items->Add();
Item->Caption = i;
}
ListView1->Items->Item[]->Selected = true;
ListView1->ViewStyle=vsReport; TListColumn *pCol=;
pCol=ListView1->Columns->Add();
pCol->Caption="学号";
pCol=ListView1->Columns->Add();
pCol->Caption="姓名";
pCol=ListView1->Columns->Add();
pCol->Caption="成绩";
TListItem *pItem=;
//添加9行
for(int i=;i<;i++)
{
pItem=ListView1->Items->Add();
//第1列
pItem->Caption=String(i+);
//第2列
pItem->SubItems->Add("学生"+String(i+));
//第3列
pItem->SubItems->Add("bcb群[4670-3864]");
} ListView1->Items->Item[i]->Caption = "第i行第1列的值";
ListView1->Items->Item[i]->SubItems->Strings[]= "第i行第2列的值";
ListView1->Items->Item[i]->SubItems->Strings[]= "第i行第3列的值";
ListView1->Items->Item[i]->SubItems->Strings[]= "第i行第4列的值";
ListView1->Items->Item[0]->Caption;
ListView1->Items->Item[0]->EditCaption();
ListView1->Items->Item[0]->EditCaption();
ListView取得EditCaption后EDITLABEL句柄
ListView1->Items->Item[]->EditCaption();
String atext = ListView1->Items->Item[]->Caption;
ListView1->SetFocus();
HWND ahandle = (HWND) SendMessage(ListView1->Handle, LVM_EDITLABEL, (WPARAM), (LPARAM)); int SelLen = atext.Pos(".") - ;
SendMessage(ahandle, EM_SETSEL, , SelLen);
SendMessage(ahandle, EM_SCROLLCARET, , );
修改ListView的内容
ListView1->Column[]->Caption = "标题1";
ListView1->Column[]->Caption = "标题2"; ListView1->Items->Item[]->Caption = "第1行第1列的值";
ListView1->Items->Item[]->SubItems->Strings[] = "第1行第2列的值";
ListView1->Items->Item[]->SubItems->Strings[] = "第1行第3列的值";
//udpate title
this->ListView1->Columns->Items[]->Caption = "a";
this->ListView1->Columns->Items[]->Caption = "b";
this->ListView1->Columns->Items[]->Caption = "c";
ListView1->ViewStyle = vsReport;
TListColumn * Item;
for ( int i = ; i < ; i++ )
{
Item = ListView1->Columns->Add( );
Item->Caption = i;
} TListItem * pItem = ;
for ( int i = ; i < ; i++ )
{
pItem = ListView1->Items->Add( );
// 第1列
pItem->Caption = String( i + );
for ( int j = ; j < ListView1->Columns->Count; j++ )
{
// 第2..n列
pItem->SubItems->Add( String( j + ) );
}
}
复选框
Specifies whether check boxes appear next to the items in the list view.
Set Checkboxes to true to make check boxes appear next to the list items when ViewStyle is vsList or vsReport. Each line in the list displays a single check box.
全选/全不选
for (int i = ; i < ListView1->Items->Count; i++)
{
ListView1->Items->Item[i]->Checked = chk1ALL->Checked;
}
ListView 操作的更多相关文章
- 安卓ListView操作的两种方法
举例做一个微信的中间部分(好友消息等信息通知) 第一种:BaseAdapter() package com.example.wx; import java.util.ArrayList;import ...
- Listview操作
设置 listView1.VirtualMode = true; listView1.RetrieveVirtualItem += ListView1_RetrieveVirtualItem; p ...
- TreeView和ListView数据库查询数据联动操作
好久不用了,重新整理下放这里以备需要使用,功能见图 数据库表结构 定义TreeView addObject中data存储的记录集 type PNode = ^TNode; TNode = record ...
- Android在listview添加checkbox实现单选多选操作问题(转)
转自:http://yangshen998.iteye.com/blog/1310183 在Android某些开发需求当中,有时候需要在listveiw中加入checkbox实现单选,多选操作.表面上 ...
- android listview综合使用示例_结合数据库操作和listitem单击长按等事件处理
本示例说明: 1.自定义listview条目样式,自定义listview显示列数的多少,灵活与数据库中字段绑定. 2.实现对DB的增删改查,并且操作后listview自动刷新. 3.响应用户操作点击事 ...
- ListView多选操作模式详解CHOICE_MODE_MULTIPLE与CHOICE_MODE_MULTIPLE_MODAL
这篇文章我们将详细的介绍如何实现ListView的多选操作,文中将会纠正在使用ListViewCHOICE_MODE_MULTIPLE或者CHOICE_MODE_MULTIPLE_MODAL时容易犯的 ...
- Android(java)学习笔记186:对ListView等列表组件中数据进行增、删、改操作
1.ListView介绍 解决大量的相似的数据显示问题 采用了MVC模式: M: model (数据模型) V: view (显示的视图) C: controller 控制器 入门案例: acit ...
- android listview综合使用演示样例_结合数据库操作和listitem单击长按等事件处理
本演示样例说明: 1.自己定义listview条目样式,自己定义listview显示列数的多少,灵活与数据库中字段绑定. 2.实现对DB的增删改查,而且操作后listview自己主动刷新. 3.响应用 ...
- ListView多选操作模式——上下文操作模式
1.什么叫上下文操作模式 2.如何进入上下文操作模式 1.ListView自身带了单选.多选模式,可通过listview.setChoiceMode来设置: listview.setChoiceMod ...
随机推荐
- ES6必知必会 (五)—— Promise 对象
Promise 对象 1.Promise对象是ES6对异步编程的一种解决方案,它有以下两个特点: Promise对象代表一个异步操作,它只有三种状态:Pending(进行中).Resolved(已完成 ...
- STS或eclipse安装SVN插件(转)
安装sts--SVN插件 简介:sts是与eclipse类似的Java IDE开发工具(不了解的百度) 1.sts菜单栏 help->install New Software 依据大家的版本选择 ...
- 下载各个版本java (Java Development Kit)
本文介绍怎么样下载各个版本java开发工具包. 方法/步骤 打开官方下载网址:http://www.oracle.com/technetwork/java/javase/downloads/ind ...
- WebApi_使用技巧
1.自动生成帮助文档 http://www.shaoqun.com/a/234059.aspx 2.Json序列化循环引用的问题http://www.mamicode.com/info-detail ...
- 【转】每天一个linux命令(60):scp命令
原文网址:http://www.cnblogs.com/peida/archive/2013/03/15/2960802.html scp是secure copy的简写,用于在Linux下进行远程拷贝 ...
- [boost] : asser库用法
基本用法 需要包含头文件#include <boost/assert.hpp> assert库定义了两个断言宏 BOOST_ASSERT BOOSE_ASSERT_MSG 第一种形式等价于 ...
- c# 多线程排队队列实现的源码
[csharp] view plaincopy using System; using System.Threading; using System.Collections; using System ...
- WCF揭秘学习笔记(5):WF定制活动
WF(Windows Workflow Foundation,Windows工作流基础)为.NET提供了一种基于模型的.声明方式的过程执行引擎,它改变了传统的通过一行行编写代码来开发服务功能的方式. ...
- Django 博客项目02 Form验证+ 上传头像(预览)+Ajax用户注册
头像预览 $("#avatar_file").change(function(){ // 获取上传的文件对象 var file=$(this)[0].files[0]; // 读取 ...
- [转]html 下拉框级联
<html> <head> <title>html 下拉框级联</title> <meta charset="UTF-8"/& ...