Ver Mensaje Individual
  #6  
Antiguo 09-06-2013
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
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.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 10-06-2013 a las 16:05:05. Razón: cambio del servidor de imagen
Responder Con Cita