Esempio n. 1
0
        protected HabaneroMenu CreateHabaneroMenuFullySetup()
        {
            IControlFactory controlFactory = GetControlFactory();
            IFormHabanero   form           = controlFactory.CreateForm();

            return(new HabaneroMenu("Main", form, controlFactory));
        }
Esempio n. 2
0
        /// <summary>
        /// Sets the current control to the one with the specified heading
        /// </summary>
        /// <param name="heading">The heading</param>
        /// <returns>Returns the relevant IFormControl object</returns>
        public IFormControl SetCurrentControl(String heading)
        {
            if (_formsbyHeading == null)
            {
                _formsbyHeading = new Hashtable();
                _formsbyForm    = new Hashtable();
            }
            if (_formsbyHeading.Contains(heading))
            {
                IFormHabanero frm = (IFormHabanero)_formsbyHeading[heading];
                if (_fontSize != 0.0f)
                {
                    frm.Font = new Font(frm.Font.FontFamily, _fontSize);
                }
                frm.Show();
                frm.Refresh();
                frm.Focus();
                frm.PerformLayout();
                return((IFormControl)frm.Controls[0]);
            }
            IFormControl formCtl = GetFormControl(heading);

            IFormHabanero newMdiForm = _controlFactory.CreateForm();

            newMdiForm.Width       = 800;
            newMdiForm.Height      = 600;
            newMdiForm.MdiParent   = _parentForm;
            newMdiForm.WindowState = FormWindowState.Maximized;

            //IControlHabanero ctl = formCtl;

            newMdiForm.Text = heading;
            newMdiForm.Controls.Clear();
            BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(newMdiForm);

            layoutManager.AddControl((IControlHabanero)formCtl, BorderLayoutManager.Position.Centre);
            newMdiForm.Show();
            _formsbyHeading.Add(heading, newMdiForm);
            _formsbyForm.Add(newMdiForm, heading);
            formCtl.SetForm(newMdiForm);
            newMdiForm.Closed += MdiFormClosed;

            return(formCtl);
        }