刚刚在找关于ListView的资料,意外的发现了这个网站: http://csharp.net-informations.com/gui/cs-listview.htm
上面列举了很多C#常见控件的使用。
C# ListView Control

The ListView control is an ItemsControl that is derived from ListBox.

Add Columns in ListView

You can add columns in Listview by using Columns.Add() method. This method takes two arguments, first one is the Column heading and second one the column width.

listView1.Columns.Add("ProductName", 100);

In the above code, "ProductName" is column heading and 100 is column width.

Add Item in Listview

You can add items in listbox using ListViewItem which represents an item in a ListView control.

string[] arr = new string[4];    ListViewItem itm;//add items to ListView    arr[0] = "product_1";    arr[1] = "100";    arr[2] = "10";    itm = new ListViewItem(arr);    listView1.Items.Add(itm);

Get selected item from ListView

productName = listView1.SelectedItems[0].SubItems[0].Text;

Above code will return the itme from first column of first row.

Sorting Listview Items

If the Sorted property of Listview is set to true, then the ListView items are sorted. The following code sorts the ListView items:

ListView1.Sorted = true;

Add Checkbox in Listview

You can add checkbox in Listview columns.

myListView.CheckBoxes = true;myListView.Columns.Add(text, width, alignment);

ListView provides a large number of properties that provide flexibility in appearance and behavior. The View property allows you to change the way in which items are displayed. The SelectionMode property for a ListView determines how many items a user can select at one time.

The following C# program first set its view property as Details and GridLines property as true and FullRowSelect as true.

listView1.View = View.Details;listView1.GridLines = true;listView1.FullRowSelect = true;

Finally at the button click event, it will display the selected row values in a message box.

Next :  C# Menu Control
Download Source Code
Print Source Code
using System;
using System.Drawing;
using System.Windows.Forms;namespace WindowsFormsApplication1
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){listView1.View = View.Details;listView1.GridLines = true;listView1.FullRowSelect = true;//Add column headerlistView1.Columns.Add("ProductName", 100);listView1.Columns.Add("Price", 70);listView1.Columns.Add("Quantity", 70);//Add items in the listviewstring[] arr = new string[4];ListViewItem itm ;//Add first itemarr[0] = "product_1";arr[1] = "100";arr[2] = "10";itm = new ListViewItem(arr);listView1.Items.Add(itm);//Add second itemarr[0] = "product_2";arr[1] = "200";arr[2] = "20";itm = new ListViewItem(arr);listView1.Items.Add(itm);}private void button1_Click(object sender, EventArgs e){string productName = null;string price = null;string quantity = null;productName = listView1.SelectedItems[0].SubItems[0].Text;price = listView1.SelectedItems[0].SubItems[1].Text;quantity = listView1.SelectedItems[0].SubItems[2].Text;MessageBox.Show (productName + " , " + price + " , " + quantity);}}
}

  • C# Visual Studio IDE
  • How to Create a C# Windows Forms Application
  • C# Label Control
  • C# Button Control
  • C# TextBox Control
  • C# ComboBox
  • C# ListBox Control
  • C# Checked ListBox Control
  • C# RadioButton Control
  • C# CheckBox Control
  • C# PictureBox Control
  • C# ProgressBar Control
  • C# ScrollBars Control
  • C# DateTimePicker Control
  • C# Treeview Control
  • C# Menu Control
  • C# MDI Form
  • C# Color Dialog Box
  • C# Font Dialog Box
  • C# OpenFile Dialog Box
  • C# Print Dialog Box
  • keyPress event in C# , KeyDown event in C# , KeyUp event in C#
  • How to create Dynamic Controls in C# ?
  • Keep Form on Top of All Other Windows
  • C# Timer Control
name="fb_xdm_frame_http" frameborder="0" allowtransparency="true" allowfullscreen="true" scrolling="no" id="fb_xdm_frame_http" aria-hidden="true" title="Facebook Cross Domain Communication Frame" tabindex="-1" src="http://static.ak.facebook.com/connect/xd_arbiter/R_qmi4A5CC2.js?version=41#channel=f38e92f438&origin=http%3A%2F%2Fcsharp.net-informations.com" style="border-style: none; border-width: initial;"> name="fb_xdm_frame_https" frameborder="0" allowtransparency="true" allowfullscreen="true" scrolling="no" id="fb_xdm_frame_https" aria-hidden="true" title="Facebook Cross Domain Communication Frame" tabindex="-1" src="https://s-static.ak.facebook.com/connect/xd_arbiter/R_qmi4A5CC2.js?version=41#channel=f38e92f438&origin=http%3A%2F%2Fcsharp.net-informations.com" style="border-style: none; border-width: initial;">

name="oauth2relay1166878498" id="oauth2relay1166878498" src="https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Fcsharp.net-informations.com#rpctoken=728550285&forcesecure=1" tabindex="-1" style="font-family: 微软雅黑;font-size:14px; width: 1px; height: 1px; position: absolute; top: -100px;">

  • An overview of Microsoft C#
  • C# Language Tutorial
  • C# Statements Tutorial
  • C# Graphical User Interface Tutorial
  • C# Collection Tutorial
  • C# String Tutorial
  • C# File Operations Tutorial
  • C# Excel Tutorial
  • C# Crystal Reports Tutorial
  • CSharp Communication Tutorial
  • C# Ado.Net Tutorial and Source Code , c# database programming tutorial
  • C# ADO.NET data Providers Tutorial
  • C# Dataset Tutorial
  • C# DataAdapater Tutorial
  • Csharp DataView Tutorial
  • Csharp Remoting Tutorial
  • C# XML Tutorial
  • C# DataGridView Tutorial
frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" tabindex="0" vspace="0" width="100%" id="I0_1444139529991" name="I0_1444139529991" src="https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&size=tall&annotation=none&origin=http%3A%2F%2Fcsharp.net-informations.com&url=http%3A%2F%2Fcsharp.net-informations.com%2Fgui%2Fcs-listview.htm&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.zh_CN.V2k-AL_BMvw.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Ft%3Dzcms%2Frs%3DAGLTcCMPquLJxrKq4owfMfww4Fw8-z9GDg#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Conload&id=I0_1444139529991&parent=http%3A%2F%2Fcsharp.net-informations.com&pfname=&rpctoken=23133531" data-gapiattached="true" title="+1" style="position: static; top: 0px; width: 50px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 24px;">

C#之常用控件集合(英文版)相关推荐

  1. C#常用控件的属性以及方法(转载)

    -----以前看别人的,保存了下来,但是忘了源处,望见谅. C#常用控件属性及方法介绍 目录 1.窗体(Form) 2.Label (标签)控件 3.TextBox(文本框)控件 4.RichText ...

  2. 基于WP7开发的Silverlight常用控件详解

    Silverlight是一个跨浏览器.跨客户平台的技术,能够设计.开发和发布有多媒体体验与富交互(RIA,Rich Interface Application)的网络交互程序. 针对Windows P ...

  3. DevExpress Winform 常用控件

    前言 DevExpress 控件的功能比较强大,是全球知名控件开发公司,对于开发 B/S 或 C/S 都非常出色,可以实现很炫且功能强大的效果. DevExpress Winform 常用控件是本人在 ...

  4. 11. Windows应用程序常用控件

    Windows应用程序常用控件 1 控件概述 1.1 控件的分类及作用 1.2 控件的命名规范 1.2 控件的相关操作 2.1 添加控件 2.2 对齐控件 2.3 锁定控件 2.4 删除控件 3 文本 ...

  5. Android常用控件,四大组件,intent应用

    常用控件:TextView. Button. EditText. ImageView. ProgressBar.AlterDailog. ProgressDailog 四大组件: Activity(活 ...

  6. Windows phone8 基础篇(三) 常用控件开发

    广告:  为了方便我们大家一起学习和讨论,我开设了一个群300143953.专门关于windows phone开发学习的群.因为群刚建,所以没人.欢迎大家.另外如果出现啥错误性的问题,希望大家能够 指 ...

  7. winform常用控件介绍

    winform常用控件介绍 1.窗体 1 2.Label 控件 3 3.TextBox 控件 4 4.RichTextBox控件 5 5.NumericUpDown 控件 7 6.Button 控件 ...

  8. 控件包含代码块,因此无法修改控件集合

    文章转载至:  http://www.olnote.com/itlife/note/100000003.aspx 控件包含代码块(即<% ... %>),因此无法修改控件集合. 说明: 执 ...

  9. FineUI控件集合

    FineUI(开源版)基于 ExtJS 的开源 ASP.NET 控件库. 1 using System;2 using System.Collections.Generic;3 using Syste ...

最新文章

  1. UICollectionView
  2. java方法声明无效_java 方法声明无效 需要返回类型
  3. 文件及文件夹更改通知/监测软件TheFolderSpy
  4. 手脱UPX v0.89.6 - v1.02
  5. matlab-画个拱桥和倒影?
  6. 小小军团获取服务器配置文件,小小军团2资源攻略 六种办法让你不再缺资源
  7. C# try catch finally 执行
  8. GDCM:gdcm::FileChangeTransferSyntax的测试程序
  9. chrome应用程序无法启动因为并行配置不正确的处理办法(亲测版本不一样也是类似的操作)
  10. C++ Primer 第五版 第6章 6.2——函数参数传递阅读笔记
  11. tensorflow安装以及在Anaconda中安装使用
  12. JAVA-jdk8的API文件下载
  13. 美赛2018b题O奖论文学习(一)
  14. 实验二线性表的链式存储结构
  15. BIDS 怪异现象(转载)
  16. sql实现查询两个时间之间每月的数量
  17. 丹佛机场行李系统案例分析
  18. 驱动开发---cc1: error: code model kernel does not support PIC mode(改文件Unhelp?try it)
  19. electron 自定义右键菜单
  20. 一大波猪年元素的二维码助你跨猪年!

热门文章

  1. 如何通过查看硬件厂商ID和设备ID来查找驱动
  2. 编译原理SNL语言编译器实验报告
  3. Java实现 LeetCode 452 用最少数量的箭引爆气球
  4. imap服务器appleimap.163.com没有响应,163邮箱IMAP/SMTP设置,客户端授权码
  5. 浅谈UpdatePanel
  6. Google Earth Engine(GEE)——在线调取云端影像!
  7. Leedcode—机器人走过的路径
  8. 红色简约大气市场部营销计划PPT模板
  9. serverlet 原理_Serverlet具体解释
  10. djay pro新手使用入门必看:djay pro 基本技巧分享