示例#1
0
        private void InitializeComponent()
        {
            CustomPropertyGrid currGrid            = new CustomPropertyGrid();
            ContextMenu        currGridContextMenu = new ContextMenu();

            currGrid.Dock              = DockStyle.Fill;
            currGrid.Font              = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((System.Byte)(0)));
            currGrid.Location          = new Point(140, 0);
            currGrid.Name              = "_currGrid";
            currGrid.Size              = new Size(269, 266);
            currGrid.TabIndex          = 1;
            currGrid.PropertySort      = PropertySort.Alphabetical;
            currGrid.ToolbarVisible    = false;
            currGrid.HelpVisible       = false;
            currGrid.ContextMenu       = currGridContextMenu;
            currGridContextMenu.Popup += new EventHandler(OnPropertyGridPopupContextMenu);

            Controls.Add(currGrid);

            CurrentGrid            = currGrid;
            CurrentGridContextMenu = currGridContextMenu;
        }
        private void InitializeComponent()
        {
            currTreeView = new TreeView();
            splitter1    = new Splitter();
            panel1       = new Panel();

            CustomPropertyGrid currGrid            = new CustomPropertyGrid();
            ContextMenu        currGridContextMenu = new ContextMenu();

            panelContextMenu        = new ContextMenu();
            panelContextMenu.Popup += new EventHandler(PopupPanelContextMenu);

            currTreeView.HideSelection      = false;
            currTreeView.Dock               = DockStyle.Left;
            currTreeView.ImageIndex         = -1;
            currTreeView.Location           = new Point(0, 0);
            currTreeView.Name               = "currTreeView";
            currTreeView.SelectedImageIndex = -1;
            currTreeView.Size               = new Size(256, 266);
            currTreeView.TabIndex           = 6;
            currTreeView.ImageList          = ImageListFactory.GetImageList();
            currTreeView.AfterSelect       += new TreeViewEventHandler(OnAfterSelect);
            currTreeViewContextMenu         = new ContextMenu();
            currTreeViewContextMenu.Popup  += new EventHandler(PopupTreeViewContextMenu);
            currTreeView.MouseDown         += new MouseEventHandler(TreeViewMouseDown);
            currTreeView.KeyDown           += new KeyEventHandler(TreeViewKeyDown);

            splitter1.Dock     = DockStyle.Left;
            splitter1.Location = new Point(140, 0);
            splitter1.Name     = "splitter1";
            splitter1.Size     = new Size(2, 266);
            splitter1.TabIndex = 7;
            splitter1.TabStop  = false;

            currGridContextMenu.Popup += new EventHandler(OnPropertyGridPopupContextMenu);

            currGrid.Dock                  = DockStyle.Fill;
            currGrid.Font                  = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((System.Byte)(0)));
            currGrid.Location              = new Point(140, 0);
            currGrid.Name                  = "_currGrid";
            currGrid.Size                  = new Size(250, 266);
            currGrid.TabIndex              = 1;
            currGrid.PropertySort          = PropertySort.Alphabetical;
            currGrid.ToolbarVisible        = false;
            currGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(OnPropertyValueChanged);
            currGrid.ContextMenu           = currGridContextMenu;

            panel1.Controls.Add(currGrid);
            panel1.Dock     = DockStyle.Fill;
            panel1.Location = new Point(142, 0);
            panel1.Name     = "panel1";
            panel1.Size     = new Size(409, 266);
            panel1.TabIndex = 9;

            Controls.Add(panel1);
            Controls.Add(splitter1);
            Controls.Add(currTreeView);

            CurrentGrid            = currGrid;
            CurrentGridContextMenu = currGridContextMenu;
        }