glControl1_Resize event was not fired.

This commit is contained in:
the_fiddler 2007-11-11 19:39:09 +00:00
parent b81fdbe630
commit 9725f72fb9
2 changed files with 3 additions and 1 deletions

View file

@ -78,6 +78,7 @@
this.glControl1.Size = new System.Drawing.Size(629, 565); this.glControl1.Size = new System.Drawing.Size(629, 565);
this.glControl1.TabIndex = 0; this.glControl1.TabIndex = 0;
this.glControl1.VSync = false; this.glControl1.VSync = false;
this.glControl1.Resize += new System.EventHandler(this.glControl1_Resize);
this.glControl1.Paint += new System.Windows.Forms.PaintEventHandler(this.glControl1_Paint); this.glControl1.Paint += new System.Windows.Forms.PaintEventHandler(this.glControl1_Paint);
this.glControl1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.glControl1_KeyDown); this.glControl1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.glControl1_KeyDown);
// //

View file

@ -45,6 +45,7 @@ namespace Examples.WinForms
{ {
base.OnLoad(e); base.OnLoad(e);
glControl1_Resize(this, EventArgs.Empty); // Ensure the Viewport is set up correctly
GL.ClearColor(Color.Crimson); GL.ClearColor(Color.Crimson);
} }
@ -72,7 +73,7 @@ namespace Examples.WinForms
glControl1.SwapBuffers(); glControl1.SwapBuffers();
} }
private void glControl1_Resize(object sender, OpenTK.Platform.ResizeEventArgs e) private void glControl1_Resize(object sender, EventArgs e)
{ {
if (glControl1.ClientSize.Height == 0) if (glControl1.ClientSize.Height == 0)
glControl1.ClientSize = new System.Drawing.Size(glControl1.ClientSize.Width, 1); glControl1.ClientSize = new System.Drawing.Size(glControl1.ClientSize.Width, 1);