hi, im creating a simple image editor/drawer and im having problems with flicker when the canvas is refreshd on draw.

ive got

frmPMain->DoubleBuffered = true;

on my form, but im still getting bad flicker when i run my draw shape code such as

void Pixie_Draw::DragSquare( int X, int Y, int Width, int Height, TImage* OriginalImage,Graphics::TBitmap* BackBuffer)
{
  Graphics::TBitmap* result = new Graphics::TBitmap();
  result->Assign(BackBuffer);
  result->Canvas->Rectangle(X,Y,Height,Width);

  OriginalImage->Picture->Bitmap->Assign(result);

  delete result;
}

are there any other methods i can use to remove it?
im using Borland C++ 6

thanks

BUMP

anyone got any ideas?! ^.^

after reading a bit more material online, i think it has somthing to do with when repaints called by the assign and the img is cleard and so dosnt have a image for a split second before the new image is aplied and refreshd? am i right there?
if so how can i stop the bugger from doing it! lol

thanks

Dear OnIIcE!

If your problem is that there's no image for a split second, then You could create another TImage and copy tho contects of the old one to this, than assign the new image to the old TImage and destroy the new one.
Or You don't even have to create and destroy the new TImage every time, you can can just set its "Visible" property to true and false. At the start of your program it should be false.

Hope I helped.

Your piece of code about doublebuffering really helped me - I had a flickering canvas, too.

Thank You!

- L.

commented: Thanks for BUMPing a 2+ year old thread. He's been waiting long enough for your answer. -4
commented: Maybe someone else will have the same question and google it, and find this +4
commented: Driveby bump and run -4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.