Board index » cppbuilder » PaintTo crashes

PaintTo crashes

Hello,

Im trying to draw a form into a TBitmap, but on some forms it crashes with
an access violation. I am using this code:

     for(int j = 0; j < PageControl2->Pages[i]->ControlCount; j++)
     {
      pControl = PageControl2->Pages[i]->Controls[j];
      if(pControl->InheritsFrom(__classid(TWinControl)))
      {
        ((TWinControl *)pControl)->PaintTo(pBitmap->Canvas->Handle,
               pControl->Left,
               pControl->Top);
      }
     } // for(int j = 0; j < PageControl2->Pages[i]->ControlCount; j++)

It seems that the PaintTo method cannot work with Ctrlgrids and various
other components. Is this assumption correct or am i doing some mistake?

Any ideas?

Harald

 

Re:PaintTo crashes


Many components to not respond properly to PaintTo...

Take a look at TExcellentFormPrinter at:
http://www.code4sale.com/joehecht

TExcellentFormPrinter can print to bitmaps as well
as printers, and also has optional hooks to provide
support for 3rd party controls that may be problematic.

Joe
--
Jimmy Page is having a charity artwork sale: Action For Brazil's Children Trust: http://www.abctrust.org.uk/
Whole Lotta Love computing to cure cancer! http://www.wholelottalove.org/

Quote
> Hello,

> Im trying to draw a form into a TBitmap, but on some forms it crashes with
> an access violation. I am using this code:

Other Threads