Beispiel #1
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.F4)
            {
                System.Drawing.Point p = Control.MousePosition;
                Control ctr            = this.GetChildAtPoint(this.PointToClient(p));
                if (ctr != null)
                {
                    while (ctr.HasChildren)
                    {
                        Control ctrTemp = ctr.GetChildAtPoint(ctr.PointToClient(p));
                        if (ctrTemp != null)
                        {
                            ctr = ctrTemp;
                        }
                    }
                    PropertyGrid myPropGrid = new PropertyGrid();
                    myPropGrid.Dock           = DockStyle.Fill;
                    myPropGrid.SelectedObject = ctr;
                    Form frmPropGrid = new Form();
                    frmPropGrid.Size = new System.Drawing.Size(250, 450);
                    frmPropGrid.Controls.Add(myPropGrid);
                    frmPropGrid.ShowDialog();
                    myPropGrid.Dispose();
                    frmPropGrid.Dispose();
                }
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }
Beispiel #2
0
 public override void Dispose()
 {
     base.Dispose();
     if (grid != null)
     {
         ProjectService.SolutionClosed -= CombineClosedEvent;
         try {
             grid.SelectedObjects = null;
         } catch {}
         grid.Dispose();
         grid     = null;
         instance = null;
     }
 }
Beispiel #3
0
 public override void Dispose()
 {
     base.Dispose();
     if (grid != null)
     {
         this.ideContainer.Disconnect();
         SD.ProjectService.SolutionClosed -= SolutionClosedEvent;
         try {
             grid.SelectedObjects = null;
         } catch {}
         grid.Dispose();
         grid     = null;
         instance = null;
     }
 }
Beispiel #4
0
        protected override Control GetEditControl(object instance)
        {
            _source = instance;
            if (_source != null)
            {
                if (_panelBody != null && !_panelBody.IsDisposed)
                {
                    _panelBody.Dispose();
                }
                _panelBody        = new Panel();
                _panelBody.Width  = 800;
                _panelBody.Height = 500;
                Panel panelBottom = new Panel();
                panelBottom.Height = 80;
                panelBottom.Dock   = DockStyle.Bottom;
                _panelBody.Controls.Add(panelBottom);

                MedButton btnUp = new MedButton();
                btnUp.Click += new EventHandler(btnUp_Click);
                panelBottom.Controls.Add(btnUp);
                btnUp.Text     = "上移(&W)";
                btnUp.Location = new System.Drawing.Point(10, 10);
                btnUp.Width    = 60;

                MedButton btnDown = new MedButton();
                btnDown.Click += new EventHandler(btnDown_Click);
                panelBottom.Controls.Add(btnDown);
                btnDown.Text     = "下移(&S)";
                btnDown.Location = new System.Drawing.Point(90, 10);
                btnDown.Width    = 60;

                MedButton btnAdd = new MedButton();
                btnAdd.Click += new EventHandler(btnAdd_Click);
                panelBottom.Controls.Add(btnAdd);
                btnAdd.Text     = "添加(&A)";
                btnAdd.Location = new System.Drawing.Point(170, 10);
                btnAdd.Width    = 60;

                MedButton btnDelete = new MedButton();
                btnDelete.Click += new EventHandler(btnDelete_Click);
                panelBottom.Controls.Add(btnDelete);
                btnDelete.Text     = "删除(&D)";
                btnDelete.Location = new System.Drawing.Point(250, 10);
                btnDelete.Width    = 60;

                MedButton btnOK = new MedButton();
                btnOK.Click += new EventHandler(btnOK_Click);
                panelBottom.Controls.Add(btnOK);
                btnOK.Text     = "确定(&O)";
                btnOK.Location = new System.Drawing.Point(410, 10);
                btnOK.Width    = 60;

                if (_gird != null && !_gird.IsDisposed)
                {
                    _gird.Dispose();
                }
                _gird = new MedGridView();
                _gird.Columns.Add("显示文本", "显示文本");
                _gird.Columns.Add("字段名称", "字段名称");
                _gird.Columns.Add("宽度", "宽度");

                if (_listBox != null && !_listBox.IsDisposed)
                {
                    _listBox.Dispose();
                }
                _listBox = new ListBox();

                if (_propertyGrid != null && !_propertyGrid.IsDisposed)
                {
                    _propertyGrid.Dispose();
                }
                _propertyGrid = new PropertyGrid();

                if (_source is MedGridView)
                {
                    (_source as MedGridView).GetMedGridViewColumns(out _medGridViewColumns);
                }
                //else
                //    if (_source is MedDevGrid)
                //    {
                //        (_source as MedDevGrid).GetMedGridViewColumns(out _medGridViewColumns);
                //    }
                ResetList();

                _panelBody.Controls.Add(_gird);
                _gird.Dock = DockStyle.Left;
                _gird.BringToFront();
                _gird.Visible = false;

                _panelBody.Controls.Add(_listBox);
                _listBox.Dock = DockStyle.Left;
                _listBox.BringToFront();
                _listBox.Width += 30;
                _listBox.SelectedIndexChanged += new EventHandler(listBox_SelectedIndexChanged);

                _panelBody.Controls.Add(_propertyGrid);
                _propertyGrid.Dock = DockStyle.Fill;
                _propertyGrid.BringToFront();
                _propertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid_PropertyValueChanged);

                return(_panelBody);
            }
            else
            {
                return(base.GetEditControl(instance));
            }
        }
Beispiel #5
0
 public void Teardown()
 {
     _pg.Dispose();
     _form.Dispose();
 }