المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : DoubleBuffered problem. [modified]



C# Programming
11-12-2009, 10:40 PM
I can't understand how I can make double buffering work in my project. I read many of forums, but no one solution make it work.

I draw on child class of pictureBox - DBPictureBox(my class). When mouse moving on that DBPictureBox it was redrawing. That's all.
Below i post to show how it is works:

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
pixel = true;
Graphics graph = pictureBox1.CreateGraphics();
master = new WishMaster();
Size size = new Size(pictureBox1.Size.Width - 1, pictureBox1.Size.Height - 1);
plane = new CellPlane(size, graph);
dots = new Point[0];

tableLayoutPanel1.BringToFront();

}

protected override void OnPaint(PaintEventArgs e)
{
plane.drawplane(10);
if(dots.Length != 0)
plane.drawline(dots, pixel, 0);
plane.drawpointer(pointer);
}

protected void PlaneMouseMove(object sender, MouseEventArgs e)
{
pointer = e.********;
toolStripStatusLabel2.Text = pointer.X.ToString();
toolStripStatusLabel3.Text = pointer.Y.ToString();
Invalidate();
}
}


drawplane - is function of my class that drawing cell table. If it necessary i can post it.
DBPictureBox is:

class DBPictureBox : PictureBox
{
public DBPictureBox()
{
DoubleBuffered = true;
}

}


But DBPictureBox flickering yet.

modified on Wednesday, November 11, 2009 7:37 PM