Opentk/Source/Examples/WinForms/DerivedGLControl.cs

51 lines
1.1 KiB
C#
Raw Normal View History

2007-11-04 15:33:43 +00:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using OpenTK;
using OpenTK.Graphics;
2007-11-04 15:33:43 +00:00
namespace Examples.WinForms
{
public partial class DerivedGLControl : GLControl
{
2008-12-10 09:36:33 +00:00
Color clearColor;
public DerivedGLControl()
{
this.InitializeComponent();
}
2007-11-04 15:33:43 +00:00
public Color ClearColor
{
get { return clearColor; }
set
{
clearColor = value;
if (!this.DesignMode)
{
MakeCurrent();
GL.ClearColor(clearColor);
}
2007-11-04 15:33:43 +00:00
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (!this.DesignMode)
{
MakeCurrent();
GL.Clear(ClearBufferMask.ColorBufferBit);
SwapBuffers();
}
}
}
}