private void Form1_Load(object sender, EventArgs e) { lv.Columns.Clear(); ListViewCtrl.SetListViewStyle(ref lv); lv.Columns.Add("属性名称", "Property Name", 150, HorizontalAlignment.Left, 0); lv.Columns.Add("属性值", "Property Value", 150, HorizontalAlignment.Left, 0); }
private void CreatePropertiesArray() { m_lstProperty.Clear(); foreach (ListViewItem item in lv.Items) { Property property; property.name = ListViewCtrl.GetListViewValue("属性名称", lv, item.Index); property.value = ListViewCtrl.GetListViewValue("属性值", lv, item.Index); m_lstProperty.Add(property); } }
private void btnAddProperty_Click(object sender, EventArgs e) { if (!GlobalFunction.CheckControlInput(txtPropertyName, "Property name", 0, false)) { return; } if (!GlobalFunction.CheckControlInput(txtPropertyValue, "Property value", 0, false)) { return; } ListViewItem item = null; ListViewCtrl.AddNewListViewItem(ref item, ref lv); ListViewCtrl.SetListViewValue(txtPropertyName.Text, "属性名称", lv, ref item); ListViewCtrl.SetListViewValue(txtPropertyValue.Text, "属性值", lv, ref item); CreatePropertiesArray(); }