PDA

Ver la Versión Completa : Imprmir TreeView


nicocer
05-11-2004, 15:55:18
Hola amigos!!!
Necesito imprimir un TreeView.
En la web encontre este codigo de dephi, pero no lo puedo traducir a Builder c++, no se que significa WM_PRINT, etc..
A ver si alguine me da una mano

Saldudos


var
bmp: TBitmap;
begin
bmp := TBitmap.Create;
try
bmp.Width := TreeView1.Width;
bmp.Height := TreeView1.Height;
bmp.Canvas.Lock;
try
TreeView1.Perform(WM_PRINT, bmp.Canvas.Handle, PRF_CHILDREN or
PRF_CLIENT or PRF_NONCLIENT);
finally
bmp.Canvas.UnLock;
bmp.SaveToFile('d: ree.bmp')
end;
finally
bmp.Free
end;
end;

nicocer
05-11-2004, 16:14:21
Graphics::TBitmap *bmp = new Graphics::TBitmap;
bmp->Width = TreeView1->Width;
bmp->Height = TreeView1->Height;
bmp->Canvas->Lock();
TreeView1->Perform(100, (int ) bmp->Canvas->Handle, 100);
bmp->Canvas->Unlock();
bmp->SaveToFile("c:\dibujo.txt");

nicocer
09-11-2004, 13:12:16
Hola amigos, aca les mando el codigo q me funciona, espero q les sirva...

Nicocer.....el q se auto-contesta

Graphics::TBitmap *bmp = new Graphics::TBitmap;
TreeView1->Width=TreeView1->Width+500;
TreeView1->Height=TreeView1->Height+500;
bmp->Width = TreeView1->Width;
bmp->Height = TreeView1->Height;
bmp->Canvas->Lock();

TreeView1->Perform(WM_PRINT,(int)bmp->Canvas->Handle, PRF_CLIENT );
bmp->SaveToFile("c:/dibujo.bmp");
TreeView1->Width=TreeView1->Width-500;
TreeView1->Height=TreeView1->Height-500;
bmp->Free();