ListView Control in C#.Net
来源:互联网 发布:linux ed2k 下载工具 编辑:程序博客网 时间:2024/06/05 08:56
A ListView control allows to display a list of items. ListView is very similar to windows explorer. In ListView you can list the items in list view, icon view, detail view.
How to use ListView Control
Drag and drop ListView control from toolbox on the WindowForm.
Code:
using System;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class frmListView : Form
{
public frmListView()
{
InitializeComponent();
}
private void frmListView_Load(object sender, EventArgs e)
{
//specify which view should display of listview Item
listView1.View = View.Details;
// add columns in ListView
listView1.Columns.Add("Emp Id", 100, HorizontalAlignment.Left);
listView1.Columns.Add("Emp Name", 100, HorizontalAlignment.Left);
// add Items in ListView
listView1.Items.Add("UMS101").SubItems.Add("Yash");
listView1.Items.Add("UMS102").SubItems.Add("Raj");
}
}
}
Run the project
You can change its view in details,LargeIcon,SmallIcon,Tile,List through its view property.
When you set listView1.View = View.Tile; then listview data will show in Tile View.
ListView Properties:
View: Defines how items are displayed in the control.
CheckBoxes: Indicates whether a check box appears next to each item in the control.
Example:
private void frmListView_Load(object sender, EventArgs e)
{
// appears checkBox next to each Item
listView1.CheckBoxes = true;
}
Output
CheckBox will appear when the application run.
TileSize: Defines the size of the tiles shown in tile view.
BackColor: Set BackColor of ListView.
Example:
private void frmListView_Load(object sender, EventArgs e)
{
// Change BackColor Of ListView
listView1.BackColor = Color.CadetBlue;
}
- ListView Control in C#.Net
- 翻译:Picasa Style Photo Album Using ListView Control in ASP.Net 3.5
- ViewState in .net Client Control xss
- Extended Vertical Label Control in C# .NET
- Moving items up and down in a ListView control
- C#:Cryptography in .NET
- The Calendar Control and the DayRender Event in ASP.Net
- Implement Custom Paging in the ASP.Net Datagrid Control...
- WebBrowser control Hosting Office documents in .NET forms
- Using extjs calendar control (DateField) in ASP.NET
- [.NET] How to implement rotate image in user control.
- Inversion of Control – An Introduction with Examples in .NET
- How to use ValidationSummary control in asp.net
- Take Control Of Web Control ClientID Values in ASP.NET 4
- Transparent-Flash-Control-in-Plain-C编译问题
- Custom Draw ListView Control
- Operation Array in c++.net
- SingleTon Pattern in C#.net
- 同一进程中的线程究竟共享哪些资源
- win7 64位下vmware8.0安装Mac 10.7--------cpu支持虚拟化
- hdu 1254 推箱子 双层bfs
- HDOJ1421搬寝室(动态规划)
- POJ 2528 Mayor's posters (线段树成段更新+离散化)
- ListView Control in C#.Net
- 北大拦截导弹
- 操作系统 信号量 vs 互斥锁
- POJ 3393 Lucky and Good Months by Gregorian Calendar
- 直接拖拽ipa包就能解压出图片资源
- 如何优化Cocos2d-X游戏的内存
- for循环语句头的执行顺序
- 数据库语言(DML、DDL、DCL、DQL、TCL)
- tomcat配置