Hola DSK25.
Y ya que estamos, una idea para la miniatura.
Agregá un
TPanel del tamaño que desees la miniatura, dentro de él pone un
TImage y proba este código:
Código:
...
/* Ajustar propiedades de Panel2 y Image1 */
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Panel2->BevelInner = bsNone;
Panel2->BevelOuter = bsNone;
Panel2->Ctl3D = false;
Panel2->BorderStyle = bsSingle;
Image1->Align = alClient;
Image1->Stretch = true;
}
void WinCtrlToImage(TWinControl *aWinCtrl, TImage *aImg)
{
Graphics::TBitmap *bm = new Graphics::TBitmap;
HDC hDC;
__try {
bm->Width = aWinCtrl->Width;
bm->Height = aWinCtrl->Height;
hDC = GetWindowDC(aWinCtrl->Handle);
__try {
BitBlt(bm->Canvas->Handle, 0, 0, bm->Width,
bm->Height, hDC, 0, 0, SRCCOPY);
}
__finally {
ReleaseDC(aWinCtrl->Handle, hDC);
}
aImg->Picture->Bitmap->Canvas->Draw(0, 0, bm);
aImg->Picture->Bitmap->Assign(bm);
aImg->Stretch = true;
}
__finally {
delete bm;
}
}
Ejemplo de uso:
Código:
void __fastcall TForm1::btnToImgClick(TObject *Sender)
{
WinCtrlToImage(Panel1, Image1);
}
Ejemplo de salida:
Saludos.