Well, it depends on what you need, but there are some key ideas. First
you need to know what to do someone drags something over your panel so
you need to buffer what ever you've drawn so you can redraw it when it
becomes visible.
Here's a tutorial on double buffering.
http://www.codeproject.com/csharp/DoubleBuffering.asp
You'll need to know how to set a single pixel or range of pixels,
there's a little info on this:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1138408&SiteID=1
but it can be summed up as
//_ourbitmap is a reference to our buffer (System.Drawing.Bitmap)
_ourbitmap.SetPixel(e.X,e.Y,System.Drawing.Color.Azure);
//Draw using the stuff we learnt in double buffering.
Here's something that actually works. Create a form, add a panel and a
button.
Add this to the form's declarations. I'm using an existing bitmap for
simplicity to set up the bitmap
private System.Drawing.Bitmap _b = new Bitmap("C:\\Somebitmap.bmp");
In the buttons click event add
//ensure bitmap fits panel and assign.
_b = new System.Drawing.Bitmap(_b,panel1.Size);
panel1.BackgroundImage = _b;
In the MouseMove event of the panel add the following.
//if left button down, draw a pixel and invalidate it so it gets
redrawn.
if(System.Windows.Forms.MouseButtons.Left == e.Button)
{
_b.SetPixel(e.X,e.Y,System.Drawing.Color.Wheat);
panel1.Invalidate(new System.Drawing.Rectangle(e.X,e.Y,1,1));
}
It isn't perfect but it might get you started in the right direction.