コード例 #1
0
        public async void SetComponent(ComponentBase component)
        {
            _currentComponent = component;
            this.Content = null;

            var newControl = component.MainControl;

            if (newControl == null)
            {
                throw new Exception("The component " + component.GetType().Name + " does not define a Control.  Every component needs a control");
            }
            this.Content = newControl;

            await component.Show();
        }
コード例 #2
0
ファイル: InstallForm.cs プロジェクト: vchelaru/FlatRedBall
        public async void SetComponent(ComponentBase component)
        {
            _currentComponent = component;
            Controls.Clear();

            var newControl = component.MainControl;

            if (newControl == null)
            {
                throw new Exception("The component " + component.GetType().Name + " does not define a Control.  Every component needs a control");
            }


            var host = new ElementHost();
            host.Child = newControl;

            Controls.Add(host);
            host.Dock = DockStyle.Fill;
            host.Margin = new System.Windows.Forms.Padding(0);

            await component.Show();
        }
コード例 #3
0
        private void SetComponent(ComponentBase component)
        {
            tlpMain.Controls.Clear();

            tlpMain.Controls.Add(panelButtons, 0, 1);
            var newControl = component.MainControl;

            if (newControl == null)
            {
                throw new Exception("The component " + component.GetType().Name + " does not define a Control.  Every component needs a control");
            }
            tlpMain.Controls.Add(component.MainControl, 0, 0);
            component.MainControl.Dock = DockStyle.Fill;
            component.MainControl.Margin = new System.Windows.Forms.Padding(0);

            component.NextChanged += NextChanged_Handler;
            component.PreviousChanged += PreviousChanged_Handler;
            component.MoveToNext += btnNext_Click;
            component.MoveTo += component_MoveTo;

            component.MovedToComponent();
        }