Professional Documents
Culture Documents
Controls
Click on the buttons to change the background color for the GLControl.
Press Esc or click the close button to exit.
Implementation
This sample was created using the WinForms designer in Visual Studio. As such, the
code follows the conventions of this designer.
1. The constructor calls InitializeComponents(). This method is generated by the
designer and initializes the Form, GLControl and Buttons.
2. The glControl1_Paint event handler is called whenever GLControl needs to be
repainted. A typical Paint handler will begin by calling GL.Clear() and end with a call to
GLControl.SwapBuffers().
3. The various *Button_Click event handlers change the OpenGL clear color and
invalidate the GLControl. The Invalidate() method raises the GLControl Paint event and
ensures the updated clear color becomes visible immediately.