AddControl() public method

Add a control to the layout
public AddControl ( IControlHabanero control, Position pos, bool includeSplitter ) : IControlHabanero
control IControlHabanero The control to add
pos Position The position at which to add the control
includeSplitter bool True to include a splitter between the controls
return IControlHabanero
示例#1
0
        /// <summary>
        /// Sets all the controls up in a layout manager. By default uses the border layout manager
        /// with the editor control centre and the buttons south.
        /// </summary>
        protected virtual void CreateLayout()
        {
            BorderLayoutManager borderLayoutManager = new BorderLayoutManagerWin(this, _controlFactory);

            borderLayoutManager.AddControl(BoPanel, BorderLayoutManager.Position.Centre);
            borderLayoutManager.AddControl(Buttons, BorderLayoutManager.Position.South);
        }
        ///<summary>
        /// Constructs a new instance of a <see cref="ReadOnlyGridControlWin"/>.
        ///</summary>
        ///<param name="controlFactory">The <see cref="IControlFactory"/> to use to construct the control.</param>
        public ReadOnlyGridControlWin(IControlFactory controlFactory)
        {
            _controlFactory             = controlFactory;
            _grid                       = new ReadOnlyGridWin();
            FilterControl               = _controlFactory.CreateFilterControl();
            _buttons                    = _controlFactory.CreateReadOnlyGridButtonsControl();
            _readOnlyGridControlManager = new ReadOnlyGridControlManager(this, _controlFactory);
            InitialiseButtons();
            InitialiseFilterControl();
            BorderLayoutManager borderLayoutManager = new BorderLayoutManagerWin(this, _controlFactory);

            borderLayoutManager.AddControl(_grid, BorderLayoutManager.Position.Centre);
            borderLayoutManager.AddControl(_buttons, BorderLayoutManager.Position.South);
            borderLayoutManager.AddControl(FilterControl, BorderLayoutManager.Position.North);
            FilterMode = FilterModes.Filter;
            Grid.Name  = "GridControl";

            _doubleClickEditsBusinessObject   = false;
            DoubleClickEditsBusinessObject    = true;
            this.Grid.BusinessObjectSelected += Grid_OnBusinessObjectSelected;

            this.OnAsyncOperationStarted += (sender, e) =>
            {
                lock (this)
                {
                    this._inAsyncOperation = true;
                }
                this.Enabled       = false;
                this.UseWaitCursor = true;
                var f = this.FilterControl as Control;
                if (f != null)
                {
                    f.UseWaitCursor = true;              // just to make sure
                }
                this.Cursor = Cursors.WaitCursor;
            };
            this.OnAsyncOperationComplete += (sender, e) =>
            {
                lock (this)
                {
                    this._inAsyncOperation = false;
                }
                this.Enabled       = true;
                this.UseWaitCursor = false;
                var f = this.FilterControl as Control;
                if (f != null)
                {
                    f.UseWaitCursor = false;                 // this is required to work around sometimes coming out of async but the wait cursor is left on the filter
                }
                this.Cursor = Cursors.Default;
            };
        }
        /// <summary>
        /// Initialises the WizardControl with the IWizardController.  No logic is performed other than storing the wizard controller.
        /// </summary>
        /// <param name="wizardController"></param>
        /// <param name="controlFactory">The control factory that this control will use to create a button</param>
        public WizardControlWin(IWizardController wizardController, IControlFactory controlFactory)
        {
            if (wizardController == null) throw new ArgumentNullException("wizardController");
            if (controlFactory == null) throw new ArgumentNullException("controlFactory");
            _wizardController = wizardController;
            ControlFactory = controlFactory;

            _wizardControlManager = new WizardControlManager(this);

            var buttonPanel = CreateButtonPanel();

            _wizardStepPanel = ControlFactory.CreatePanel();

            BorderLayoutManagerWin borderLayoutManager = new BorderLayoutManagerWin(this, ControlFactory);
            borderLayoutManager.AddControl(_wizardStepPanel, BorderLayoutManager.Position.Centre);
            borderLayoutManager.AddControl(buttonPanel, BorderLayoutManager.Position.South);
        }
        /// <summary>
        /// Initialises the WizardControl with the IWizardController.  No logic is performed other than storing the wizard controller.
        /// </summary>
        /// <param name="wizardController"></param>
        /// <param name="controlFactory">The control factory that this control will use to create a button</param>
        public WizardControlWin(IWizardController wizardController, IControlFactory controlFactory)
        {
            if (wizardController == null)
            {
                throw new ArgumentNullException("wizardController");
            }
            if (controlFactory == null)
            {
                throw new ArgumentNullException("controlFactory");
            }
            _wizardController = wizardController;
            ControlFactory    = controlFactory;

            _wizardControlManager = new WizardControlManager(this);

            var buttonPanel = CreateButtonPanel();

            _wizardStepPanel = ControlFactory.CreatePanel();

            BorderLayoutManagerWin borderLayoutManager = new BorderLayoutManagerWin(this, ControlFactory);

            borderLayoutManager.AddControl(_wizardStepPanel, BorderLayoutManager.Position.Centre);
            borderLayoutManager.AddControl(buttonPanel, BorderLayoutManager.Position.South);
        }
 /// <summary>
 /// Sets all the controls up in a layout manager. By default uses the border layout manager
 /// with the editor control centre and the buttons south.
 /// </summary>
 protected virtual void CreateLayout()
 {
     BorderLayoutManager borderLayoutManager = new BorderLayoutManagerWin(this, _controlFactory);
     borderLayoutManager.AddControl(BoPanel, BorderLayoutManager.Position.Centre);
     borderLayoutManager.AddControl(Buttons, BorderLayoutManager.Position.South);
 }