In this article, you will see how double buffering is a good and simple to use technique that helps overcome the flickering problem.
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace DoubleBufferExample
{
public partial class Example : Form
{
public Example()
{
InitializeComponent();
PaintMethodSelector.SelectedIndex = 0;
TestMethodSelector.SelectedIndex = 0;
}
private void RefreshTimer_Tick(object sender, EventArgs e)
{
DoubleBufferControl1.Invalidate();
}
private void PaintMethodSelector_SelectedIndexChanged(object sender, EventArgs e)
{
DoubleBufferControl1.PaintMethod =
(DoubleBufferControl.DoubleBufferMethod) PaintMethodSelector.SelectedIndex;
}
private void TestMethodSelector_SelectedIndexChanged(object sender, EventArgs e)
{
DoubleBufferControl1.GraphicTest =
(DoubleBufferControl.GraphicTestMethods)TestMethodSelector.SelectedIndex;
}
private void RefreshInterval_ValueChanged(object sender, EventArgs e)
{
RefreshTimer.Interval = (int) RefreshInterval.Value;
}
private void StartBtn_Click(object sender, EventArgs e)
{
RefreshTimer.Enabled = true;
}
private void StopBtn_Click(object sender, EventArgs e)
{
RefreshTimer.Enabled = false;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.