コード例 #1
0
        private void InitGLControl()
        {
            this.SuspendLayout();

            // Get rid of a possibly existing old glControl
            if (this.graphicsControl != null)
            {
                Control oldControl = this.graphicsControl.Control;

                oldControl.MouseEnter     -= this.graphicsControl_MouseEnter;
                oldControl.MouseLeave     -= this.graphicsControl_MouseLeave;
                oldControl.MouseDown      -= this.graphicsControl_MouseDown;
                oldControl.MouseUp        -= this.graphicsControl_MouseUp;
                oldControl.MouseWheel     -= this.graphicsControl_MouseWheel;
                oldControl.MouseMove      -= this.graphicsControl_MouseMove;
                oldControl.GotFocus       -= this.graphicsControl_GotFocus;
                oldControl.LostFocus      -= this.graphicsControl_LostFocus;
                oldControl.PreviewKeyDown -= this.graphicsControl_PreviewKeyDown;
                oldControl.KeyDown        -= this.graphicsControl_KeyDown;
                oldControl.KeyUp          -= this.graphicsControl_KeyUp;
                oldControl.KeyPress       -= this.graphicsControl_KeyPress;
                oldControl.Resize         -= this.graphicsControl_Resize;

                this.graphicsControl.Dispose();
                this.Controls.Remove(oldControl);
            }

            // Create a new glControl
            this.graphicsControl = App.CreateRenderableSite();
            if (this.graphicsControl == null)
            {
                return;
            }

            Control control = this.graphicsControl.Control;

            control.BackColor       = Color.Black;
            control.Dock            = DockStyle.Fill;
            control.Name            = "graphicsControl";
            control.AllowDrop       = true;
            control.MouseEnter     += this.graphicsControl_MouseEnter;
            control.MouseLeave     += this.graphicsControl_MouseLeave;
            control.MouseDown      += this.graphicsControl_MouseDown;
            control.MouseUp        += this.graphicsControl_MouseUp;
            control.MouseWheel     += this.graphicsControl_MouseWheel;
            control.MouseMove      += this.graphicsControl_MouseMove;
            control.GotFocus       += this.graphicsControl_GotFocus;
            control.LostFocus      += this.graphicsControl_LostFocus;
            control.PreviewKeyDown += this.graphicsControl_PreviewKeyDown;
            control.KeyDown        += this.graphicsControl_KeyDown;
            control.KeyUp          += this.graphicsControl_KeyUp;
            control.KeyPress       += this.graphicsControl_KeyPress;
            control.Resize         += this.graphicsControl_Resize;
            this.Controls.Add(control);
            this.Controls.SetChildIndex(control, 0);

            this.ResumeLayout(true);
        }
コード例 #2
0
        private void InitGLControl()
        {
            this.SuspendLayout();

            // Get rid of a possibly existing old glControl
            if (this.graphicsControl != null)
            {
                Control oldControl = this.graphicsControl.Control;

                oldControl.Paint -= RenderableControl_Paint;

                this.graphicsControl.Dispose();
                this.Controls.Remove(oldControl);
            }

            // Create a new glControl
            this.graphicsControl = App.CreateRenderableSite();
            if (this.graphicsControl == null)
            {
                return;
            }

            Control control = this.graphicsControl.Control;

            control.BackColor = Color.Black;
            control.Dock      = DockStyle.Fill;
            control.Name      = "graphicsControl";
            control.AllowDrop = true;

            control.Paint += RenderableControl_Paint;

            this.Controls.Add(control);
            this.Controls.SetChildIndex(control, 0);

            this.ResumeLayout(true);
        }
コード例 #3
0
ファイル: CamView.cs プロジェクト: Scottyaim/duality
		private void InitGLControl()
		{
			this.SuspendLayout();

			// Get rid of a possibly existing old glControl
			if (this.graphicsControl != null)
			{
				Control oldControl = this.graphicsControl.Control;

				oldControl.MouseEnter		-= this.graphicsControl_MouseEnter;
				oldControl.MouseLeave		-= this.graphicsControl_MouseLeave;
				oldControl.MouseDown		-= this.graphicsControl_MouseDown;
				oldControl.MouseUp			-= this.graphicsControl_MouseUp;
				oldControl.MouseWheel		-= this.graphicsControl_MouseWheel;
				oldControl.MouseMove		-= this.graphicsControl_MouseMove;
				oldControl.GotFocus			-= this.graphicsControl_GotFocus;
				oldControl.LostFocus		-= this.graphicsControl_LostFocus;
				oldControl.PreviewKeyDown	-= this.graphicsControl_PreviewKeyDown;
				oldControl.KeyDown			-= this.graphicsControl_KeyDown;
				oldControl.KeyUp			-= this.graphicsControl_KeyUp;
				oldControl.KeyPress			-= this.graphicsControl_KeyPress;
				oldControl.Resize			-= this.graphicsControl_Resize;

				this.graphicsControl.Dispose();
				this.Controls.Remove(oldControl);
			}

			// Create a new glControl
			this.graphicsControl = DualityEditorApp.CreateRenderableSite();
			Control control = this.graphicsControl.Control;

			control.BackColor = Color.Black;
			control.Dock = DockStyle.Fill;
			control.Name = "graphicsControl";
			control.AllowDrop = true;
			control.MouseEnter		+= this.graphicsControl_MouseEnter;
			control.MouseLeave		+= this.graphicsControl_MouseLeave;
			control.MouseDown		+= this.graphicsControl_MouseDown;
			control.MouseUp			+= this.graphicsControl_MouseUp;
			control.MouseWheel		+= this.graphicsControl_MouseWheel;
			control.MouseMove		+= this.graphicsControl_MouseMove;
			control.GotFocus		+= this.graphicsControl_GotFocus;
			control.LostFocus		+= this.graphicsControl_LostFocus;
			control.PreviewKeyDown	+= this.graphicsControl_PreviewKeyDown;
			control.KeyDown			+= this.graphicsControl_KeyDown;
			control.KeyUp			+= this.graphicsControl_KeyUp;
			control.KeyPress		+= this.graphicsControl_KeyPress;
			control.Resize			+= this.graphicsControl_Resize;
			this.Controls.Add(control);
			this.Controls.SetChildIndex(control, 0);

			this.ResumeLayout(true);
		}