예제 #1
0
        private void btnFindCommand_Click(object sender, EventArgs e)
        {
            InputNameDialog dlg = new InputNameDialog();

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string name = dlg.InputText;

            foreach (TreeNode root in treeView1.Nodes)
            {
                foreach (TreeNode node in root.Nodes)
                {
                    if (string.Compare(node.Text, name, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        treeView1.SelectedNode = node;
                        node.EnsureVisible();
                        return;
                    }
                }
            }

            MessageBox.Show("指定的命令名称不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
예제 #2
0
        public static string GetInputString()
        {
            InputNameDialog dlg = new InputNameDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                return(dlg.InputText);
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
        private void btnAddFile_Click(object sender, EventArgs e)
        {
            InputNameDialog dlg = new InputNameDialog();

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            TreeNode node = new TreeNode(dlg.InputText, Icon_ConfigFile, Icon_ConfigFile2);

            treeView1.Nodes.Add(node);
            treeView1.SelectedNode = node;
            node.EnsureVisible();

            SetChangedAndRefreshUIAndTreeFocus();
        }