日期:2014-05-17 浏览次数:20836 次
首先初始化listview控件:
private void SetListView()
{
// Set the view to show details.
listView1.View = View.Details;
// Allow the user to edit item text.
listView1.LabelEdit = false;
// Allow the user to rearrange columns.
listView1.AllowColumnReorder = false;
// Select the item and subitems when selection is made.
listView1.FullRowSelect = true;
// Display grid lines.
listView1.GridLines = true;
// Sort the items in the list in descending order.
listView1.Sorting = SortOrder.None;
// Create columns for the items and subitems.
listView1.Columns.Add("roomTem", "环境温度(℃)");
listView1.Columns.Add("DC", "直流跳闸时间(s)");
listView1.Columns.Add("exchange", "交流跳闸时间(s)");
int width = listView1.Width / 3;
listView1.Columns["roomTem"].Width = w