I have a panel resizes with the content and sometimes that content requires the panel to be 18660 px by 118320 px.
Now on a small panel I can draw a set of images with no problem and flickering but when the panel becomes that large it starts to flicker. I already have the doublebuffering property set to true and that works fine for the small panel but when it gets too large it starts flickering...
Does anyone have any idea on how this is prevented and how I can prevent it from flickering when I scroll.... I will put some code below to illustrate how I draw on the panel and such.
I am using lockbits to create a image that is the width and height of the visible area and not the entire panel:
for (y = 0; y < height; y++)
{
if (y % size == 0)
{
if (showCons && y == 0)
seq = cons;
else
seq = Sequences[(y / size) + vs];
line = 0;
}
for (x = 0; x < width; x += size)
{
if ((offSet * 4) + (size * 4) < numBytes)
{
if (!HighLight || (HighLight && seq[(x + hs) / size] != refSequenceUp[(x + hs) / size]) == diff)
{
p = ColorImages[seq[(x / size) + hs]];
if (x + size > width)
{
Buffer.BlockCopy(p, line * size * 4, screen, offSet * 4, (width - x) * 4);
offSet += (width - x);
}
else
{
Buffer.BlockCopy(p, line * size * 4, screen, offSet * 4, size * 4);
offSet += size;
}
}
else
{
p = BlankImages[seq[(x / size) + hs]];
if (x + size > width)
{
Buffer.BlockCopy(p, line * size * 4, screen, offSet * 4, (width - x) * 4);
offSet += (width - x);
}
else
{
Buffer.BlockCopy(p, line * size * 4, screen, offSet * 4, size * 4);
offSet += size;
}
}
}
}
if (showCons && y > 0 && y == (size - 1))
{
y = -1;
showCons = !showCons;
}
line++;
}
EDIT:
Ive overridden the onpaintbackground method and left it empty and it sort of stopped flickering but still the drawing takes way longer than on a small panel and when the onpaintbackground is overidden it leaves artefacts in the image...