Exemple #1
0
        private static System.Windows.Forms.Control DynamicCreateForm(Control control, RoleResourceMapping menuItem)
        {
            System.Windows.Forms.Form _form = null;

            IMaintenanceControlable _query = control as IMaintenanceControlable;

            if (_query != null)//实现该接口,为一般查询窗口,对应承载窗体为frmQueryBase
            {
                _form      = new frmQuery(_query);
                _form.Text = control.Text;
                _form.Icon = HIS.Properties.Resources.标无白边;
                return(_form);
            }

            IControlable _operation = control as IControlable;

            if (_operation != null)//业务操作窗口,承载窗体为frmOperationBase
            {
                TreeView _tree = null;

                //生成树
                if (!string.IsNullOrEmpty(menuItem.Resource.TreeName))
                {
                    _tree = CreateTree(menuItem.Resource.TreeName, menuItem.Resource.TreeDllName);
                    if (_tree == null)
                    {
                        return(null);
                    }
                }

                if (_tree == null)
                {
                    _form = new frmBaseForm(control);
                }
                else
                {
                    _form = new frmBaseForm(control, _tree);
                }
                _form.Text = control.Text;
            }
            else
            {
                //_form = new System.Windows.Forms.Form();
                //_form.Controls.Add(control);
                //_form.Size = new Size(control.Size.Width + 10, control.Size.Height + 30);
                //_form.StartPosition = FormStartPosition.CenterScreen;

                // _form.Text = control.Text;
                return(control);
            }

            _form.Tag  = menuItem.Parameter;
            _form.Icon = HIS.Properties.Resources.标无白边;
            return(_form);
        }
Exemple #2
0
 protected override void OpenChildForm(frmBaseForm childForm)
 {
     childForm.MdiParent = this;
     childForm.Show();
 }