private void OnNewValueAction(RegistryValueKind valueKind) { if (tvwKeys.SelectedNode == null) { return; } RegistryKey key = (RegistryKey)tvwKeys.SelectedNode.Tag; string name = RegUtility.GetNewValueName(key); ListViewItem item = AddValueToList(key, new RegValue(name, valueKind, valueKind.GetDefaultData())); lstValues.LabelEdit = true; item.BeginEdit(); }
/// <summary> /// 根据VALUE类型创建一个新的VALUE /// </summary> internal static void OnCreateNewValueAction(RegistryValueKind valueKind) { // 如果当前TreeView没有选中节点,函数直接退出 if (MainForm.main.treeView_Registry.SelectedNode == null) { return; } // 获取选中节点的RegistryKey对象 RegistryKey key = MainForm.main.treeView_Registry.SelectedNode.Tag as RegistryKey; // 为新VALUE创建一个名字 string name = cRegOtherFunction.GetNewValueName(key); // 将新VALUE添加到ListView中 ListViewItem lvi = AddValueToListViewItem(key, new cRegValue(name, valueKind, valueKind.GetDefaultData())); // 开启Lable编辑功能 MainForm.main.listView_Registry.LabelEdit = true; lvi.BeginEdit(); }