I have a downloaded images app in mobile. Every times an image is download successful, it auto draw on to a temp bitmap and then onPaint method draw the whole temp bitmap. It caused the flikering happened to much.
My instructor advised me to use GDI functions to draw the temp bitmap onto the screen every times one image loaded. But his suggestion is so general with the two method.
[DllImport("coredll.dll")]
static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("coredll.dll")]
static extern void ReleaseDC(IntPtr dc);
So any more clearer advice for me in this situation in what he suggested? Thanks in advance.
UPDATE
//This is my buffer bitmap
private Graphics offGraph;
private Bitmap offBitmap;
//everytime an image is loaded, it raise an event and then I draw it on buffer.
private void ImageLoadDone(object sender, EventArgs e)
{
ImageObj LoadedImg = (ImageObj)sender;
LoadedImg.Render(offGraph);
this.BeginInvoke(new EventHandler(ImageUpdate));
}
private void ImageUpdate(object sender, EventArgs myE)
{
this.Render();
}
//and then onPaint draw the offbitmap.
private void Render()
{
CtrlGraph.DrawImage(offBitmap,0,0);
}