| Author |
Message |
radhutz |
| Location: |
|
Post subject: mencetak / print form
Posted: 19/Sep/2009 09:55
|
|
onIntermediate

Joined: 02-Sep-2009
Posts: 33
Status: Offline
|
|
dear, delphiers..
saya mau tanya caranya ngeprint form delphi gimana??
jadi beserta image2nya..
karna yg saya tau mencetak database dengan RAV tapi nggak bisa gambar..
terima kasih atas bantuannya.. |
|
|
| |
|
|
|
 |
|
mas_kofa |
| Location: New York Arto |
|
Post subject: RE: mencetak / print form
Posted: 20/Sep/2009 18:42
|
|
onElite

Joined: 18-Mar-2006
Posts: 1753
Location: New York Arto
|
|
|
|
|
 |
Penjahat |
| Location: |
|
Post subject: RE: mencetak / print form
Posted: 23/Sep/2009 19:46
|
|
onIntermediate
Joined: 10-Nov-2007
Posts: 35
Status: Offline
|
|
Yups... pertanyaan kurang jelas
kalo yang dimaksud adalah nge-print form, itu sangat simpel. Perintahnya cuma Print; that's all.
kalo yg dimaksud menggunakan Report, anda harus menjelaskan menggunakan report apa. Karena walau setiap report metodenya hampir sama, tapi tetep aja beda. Hampir semua report mendukung blob image.
"mencetak database" --> saya kurang paham dengan maksud anda
"dengan RAV tapi nggak bisa gambar" --> saya juga kurang paham dengan yg ini
saya akan senang sekali kalo anda mau menjelaskan lebih detail apa itu RAV |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: mencetak / print form
Posted: 23/Sep/2009 23:22
|
|
onKnowledgeable

Joined: 14-Oct-2007
Posts: 135
|
|
di tunggu ke-jelasannya @radhutz  |
|
|
| |
|
|
|
 |
radhutz |
| Location: |
|
Post subject: RE: mencetak / print form
Posted: 24/Sep/2009 11:42
|
|
onIntermediate

Joined: 02-Sep-2009
Posts: 33
Status: Offline
|
|
maaf baru reply..
mksud saya bagaimana mencetak form yang ada di aplikasi delphi, kao form itu terdiri dari gambar?!
karna setau saya sampai saat ini, saya hanya taui coding untuk mencetak laporan yang berhubungan dengan database/access sedangkan apabila dalam satu form itu ada image yang membaca data, seperti grafik, saya tidak tau codingnya untuk mencetaknya..
sebagai contoh, apabila dalam satu form aplikasi delphi, terdapat gambar grafik, string grid, listbox, dan image tambahan, apabila saya menekan tombol "Print" maka akan terhubung dengan printer yang akan mencetak apa yang terdapat dalam form, baik gambar, grafik, maupun komponen lainnya..
semoga keterangan saya ini lebih jelas..
terima kasih atas bantuannya.. |
|
|
| |
|
|
|
 |
heriy4nt0 |
| Location: |
|
Post subject: RE: mencetak / print form
Posted: 24/Sep/2009 11:44
|
|
onKnowledgeable

Joined: 25-Jul-2008
Posts: 145
Status: Offline
|
|
Untuk nge-print seluruh form, hanya buat apa ya..,bukannya lebih bagus dari report ?
- tambahkan unit printers di clause Uses
---print seluruh form termasuk image gambar(termasuk dari timage component)---
var r:trect
Printer.BeginDoc;
r:=Rect(0,0,printer.PageWidth,Printer.PageHeight);
Printer.Canvas.Rectangle(r);
Printer.Canvas.CopyRect(r,Canvas,ClientRect);
Printer.EndDoc; |
|
|
| |
|
|
|
 |
radhutz |
| Location: |
|
Post subject: RE: mencetak / print form
Posted: 25/Sep/2009 11:10
|
|
onIntermediate

Joined: 02-Sep-2009
Posts: 33
Status: Offline
|
|
karna ada gambarnya..
kalo report setau saya,, hanya tulisan ya?!
thanks for the reply.. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: mencetak / print form
Posted: 28/Sep/2009 18:32
|
|
onMage

Joined: 06-Feb-2006
Posts: 2401
|
|
saya tidak ingat sejak Delphi versi berapa, namun yg jelas ada method Form.Print yg bisa digunakan untuk mencetak form.
code : pascal // property AForm.PrintScale utk set pensekalaan pencetakan AForm.Print;
berikut sy cantumkan code Form.Print:
code : pascal procedure TCustomForm.Print; var FormImage: TBitmap; InfoSize: DWORD; ImageSize: DWORD; Bits: HBITMAP; DIBWidth, DIBHeight: Longint; PrintWidth, PrintHeight: Longint; {$IF DEFINED(CLR)} LBuffer: IntPtr; Info: TBitmapInfo; Image: TBytes; {$ELSE} Info: PBitmapInfo; Image: Pointer; {$IFEND} begin Printer.BeginDoc; try FormImage := GetFormImage; Canvas.Lock; try { Paint bitmap to the printer } with Printer, Canvas do begin Bits := FormImage.Handle; GetDIBSizes(Bits, InfoSize, ImageSize); {$IF DEFINED(CLR)} LBuffer := Marshal.AllocHGlobal(InfoSize); try SetLength(Image, ImageSize); GetDIB(Bits, 0, LBuffer, Image); Info := TBitmapInfo(Marshal.PtrToStructure(LBuffer, TypeOf(TBitmapInfo))); {$ELSE} Info := AllocMem(InfoSize); try Image := AllocMem(ImageSize); try GetDIB(Bits, 0, Info^, Image^); {$IFEND} with Info.bmiHeader do begin DIBWidth := biWidth; DIBHeight := biHeight; end; case PrintScale of poProportional: begin PrintWidth := MulDiv(DIBWidth, GetDeviceCaps(Handle, LOGPIXELSX), PixelsPerInch); PrintHeight := MulDiv(DIBHeight, GetDeviceCaps(Handle, LOGPIXELSY), PixelsPerInch); end; poPrintToFit: begin PrintWidth := MulDiv(DIBWidth, PageHeight, DIBHeight); if PrintWidth < PageWidth then PrintHeight := PageHeight else begin PrintWidth := PageWidth; PrintHeight := MulDiv(DIBHeight, PageWidth, DIBWidth); end; end; else PrintWidth := DIBWidth; PrintHeight := DIBHeight; end; {$IF DEFINED(CLR)} Marshal.StructureToPtr(TObject(Info), LBuffer, True); StretchDIBits(Canvas.Handle, 0, 0, PrintWidth, PrintHeight, 0, 0, DIBWidth, DIBHeight, Image, LBuffer, DIB_RGB_COLORS, SRCCOPY); finally Marshal.FreeHGlobal(LBuffer); {$ELSE} StretchDIBits(Canvas.Handle, 0, 0, PrintWidth, PrintHeight, 0, 0, DIBWidth, DIBHeight, Image, Info^, DIB_RGB_COLORS, SRCCOPY); finally FreeMem(Image, ImageSize); end; finally FreeMem(Info, InfoSize); {$IFEND} end; end; finally Canvas.Unlock; FormImage.Free; end; finally Printer.EndDoc; end; end;
|
_________________ Dude, if you don't understand the basics and just want to get someone else write the code for you, it means you really shouldn't study computer science. Find a different field.
http://delphiexpert.wordpress.com
|
| |
|
|
|
 |
|
|
|