GetPropertyGrid() публичный Метод

public GetPropertyGrid ( ) : PropertyGrid
Результат PropertyGrid
Пример #1
0
        public Form1()
        {
            InitializeComponent();

            m_propertyGrid = new Form3();
            m_propertyGrid.Show(dockPanel1);
            m_propertyGrid.DockTo(dockPanel1, DockStyle.Right);

            this.MdiChildActivate += (o, e) =>
            {
                if (this.ActiveMdiChild == null) return;

                PropertyGrid grid = m_propertyGrid.GetPropertyGrid();
                grid.SelectedObject = new FileInfo((this.ActiveMdiChild as Form2).Tag.ToString());

                m_treeViewList.SelectFilePath((this.ActiveMdiChild as Form2).Tag.ToString());
            };

            m_treeViewList = new Form4();
            m_treeViewList.Show(dockPanel1);
            m_treeViewList.DockTo(dockPanel1, DockStyle.Left);

            m_treeViewList.GetFileSysTreeView().NodeMouseDoubleClick += (o, e) =>
                {
                    string path = m_treeViewList.GetPathByNode(e.Node);
                    Form2 form = GetForm2ByPath(path);
                    if (form == null) return;
                    this.ActivateMdiChild(form);
                };

            m_treeViewList.FileChanged += s =>
                {
                    Form2 f2 = GetForm2ByPath(s);
                    if (f2 == null) return;
                    if (f2.GetRichTextBox().Text == File.ReadAllText(s, Encoding.Default).Replace("\r\n", "\n")) return;

                    if (MessageBox.Show(s + "被从外部改变,要重新加载吗?", "确认", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        ActivateMdiChild(f2);
                        this.closeToolStripMenuItem_Click(null, null);
                        OpenFile(s);
                    }
                };
            m_treeViewList.FileDeleted += s =>
                {
                    Form2 f2 = GetForm2ByPath(s);
                    if (f2 == null) return;
                    if (MessageBox.Show(s + "被从外部删除,要关闭文件吗?", "确认", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        ActivateMdiChild(f2);
                        this.closeToolStripMenuItem_Click(null, null);
                    }
                };
        }
Пример #2
0
        public Form1()
        {
            InitializeComponent();

            m_propertyGrid = new Form3();
            m_propertyGrid.Show(dockPanel1);
            m_propertyGrid.DockTo(dockPanel1, DockStyle.Right);

            this.MdiChildActivate += (o, e) =>
            {
                if (this.ActiveMdiChild == null)
                {
                    return;
                }

                PropertyGrid grid = m_propertyGrid.GetPropertyGrid();
                grid.SelectedObject = new FileInfo((this.ActiveMdiChild as Form2).Tag.ToString());

                m_treeViewList.SelectFilePath((this.ActiveMdiChild as Form2).Tag.ToString());
            };

            m_treeViewList = new Form4();
            m_treeViewList.Show(dockPanel1);
            m_treeViewList.DockTo(dockPanel1, DockStyle.Left);

            m_treeViewList.GetFileSysTreeView().NodeMouseDoubleClick += (o, e) =>
            {
                string path = m_treeViewList.GetPathByNode(e.Node);
                Form2  form = GetForm2ByPath(path);
                if (form == null)
                {
                    return;
                }
                this.ActivateMdiChild(form);
            };

            m_treeViewList.FileChanged += s =>
            {
                Form2 f2 = GetForm2ByPath(s);
                if (f2 == null)
                {
                    return;
                }
                if (f2.GetRichTextBox().Text == File.ReadAllText(s, Encoding.Default).Replace("\r\n", "\n"))
                {
                    return;
                }

                if (MessageBox.Show(s + "被从外部改变,要重新加载吗?", "确认", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    ActivateMdiChild(f2);
                    this.closeToolStripMenuItem_Click(null, null);
                    OpenFile(s);
                }
            };
            m_treeViewList.FileDeleted += s =>
            {
                Form2 f2 = GetForm2ByPath(s);
                if (f2 == null)
                {
                    return;
                }
                if (MessageBox.Show(s + "被从外部删除,要关闭文件吗?", "确认", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    ActivateMdiChild(f2);
                    this.closeToolStripMenuItem_Click(null, null);
                }
            };
        }