archive-com.com » COM » E » EFG2.COM

Total: 878

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

  • following code which may also fix your problem it works in D1 and D2 Needs modification to work in D3 which is shown after the D1 D2 version Delphi 1 and Delphi 2 version procedure MemFree Ptr Pointer Size Longint begin if Size wrote in article How do I print a BitMap What functions print a TBitMap object to the printer in D3 I think there is a TForm print

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0529.txt (2016-02-14)
    Open archived version from archive



  • BitmapImage ImageSize TRY GetDIB Bitmap Handle Bitmap Palette BitmapHeader BitmapImage StretchDIBits Canvas Handle DestRect Left DestRect Top Destination Origin DestRect Right DestRect Left Destination Width DestRect Bottom DestRect Top Destination Height 0 0 Source Origin Bitmap Width Bitmap Height Source Width Height BitmapImage TBitmapInfo BitmapHeader DIB RGB COLORS SRCCOPY FINALLY FreeMem BitmapHeader FreeMem BitmapImage END END PrintBitmap FUNCTION CenterText s STRING INTEGER BEGIN RESULT Printer PageWidth Printer Canvas TextWidth s DIV 2 END CenterText PROCEDURE PrintFooterTimeStamp CONST LeftMargin INTEGER VAR s STRING BEGIN Footer Printer Canvas Font Name Arial Printer Canvas Brush Color clWhite Printer Canvas Font Height MulDiv GetDeviceCaps Printer Canvas Handle LOGPIXELSY 8 72 s FormatDateTime m d yy h nn Now Printer Canvas TextOut LeftMargin Printer PageHeight Printer Canvas TextHeight X s END PrinterFooterTimeStamp Print Bitmap in landscape orientation with printed image width 80 of page procedure TForm1 ButtonPrintClick Sender TObject VAR Bitmap TBitmap iFromLeftMargin INTEGER iPrintedImageWidth INTEGER jDelta INTEGER jFromTopOfPage INTEGER jPrintedImageHeight INTEGER s STRING begin Screen Cursor crHourGlass TRY Printer Orientation poLandscape Printer BeginDoc Header Printer Canvas Font Height MulDiv GetDeviceCaps Printer Canvas Handle LOGPIXELSY 12 72 Printer Canvas Font Name Arial jDelta Printer Canvas TextHeight X jFromTopOfPage 3 jDelta s Image Title Printer Canvas

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/Printing/PrintGIFImage.TXT (2016-02-14)
    Open archived version from archive


  • a panel I have placed several images and assorted graphic controls on the panel Now I want to print it out My problem is the panel does not have a canvas property Some how I should be able to manipulate the graphics on the panel What I thought might work is to do a screen capture of the panel area but I am not sure what the function calls are Does anybody have any ideas I want to be able to scale the image and print it to a specific part of the page The Form has a canvas You can create a new bitmap the same size as your panel and then use CopyRect to copy the Panel and its content from the Form to this in memory bitmap Then you can print the in memory bitmap Here s an example procedure TFormPrintWindows ButtonPrintPanelClick Sender TObject var Bitmap TBitmap FromLeft INTEGER FromTop INTEGER PrintedWidth INTEGER PrintedHeight INTEGER begin Printer BeginDoc TRY Bitmap TBitmap Create TRY Bitmap Width Panel1 Width Bitmap Height Panel1 Height Bitmap PixelFormat pf24bit avoid palettes Copy the Panel area from the Form into a separate Bitmap Bitmap Canvas CopyRect Rect 0 0 Bitmap Width Bitmap Height

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0603b.txt (2016-02-14)
    Open archived version from archive


  • A4 paper is slightly less square than US 8 5x11 printing a square image can have the top and bottom of the image trimmed Below I am sending you a variation of the code which fixes this It adds two bits of code 1 it checks whether the IMAGE is taller or wider and selects landscape or portrait to suit 2 it then checks the IMAGE aspect ratio versus the PRINTER aspect ratio to see whether height or width is the constraint on scaling chris p s I am not trying to complain here it is great you have posted such a great set of tools I also realize that it is important to distribute minimalistic code to teach concepts It is possible that my code would confuse more people than it would help procedure TForm1 ButtonPrintClick Sender TObject VAR Bitmap TBitmap liHt liWid iFromLeftMargin iPrintedImageWidth jDelta jFromTopOfPage jPrintedImageHeight INTEGER begin liHt Image1 Picture Height liWid Image1 Picture Width if liHt 0 or liWid 0 then exit Screen Cursor crHourGlass TRY if liHt liWid then Printer Orientation poPortrait image is taller than wide else Printer Orientation poLandscape image is wider than tall Printer BeginDoc Printer Canvas Font Height fixed 28 Aug 2000 MulDiv GetDeviceCaps Printer Canvas Handle LOGPIXELSY 8 72 Printer Canvas Font Name Arial jDelta Printer Canvas TextHeight X jFromTopOfPage 3 jDelta s Image Title Printer Canvas TextOut CenterText s jFromTopOfPage s 5th line from top jFromTopOfPage 5 jDelta Image position and size 12 left and right margin iFromLeftMargin MulDiv Printer PageWidth 12 100 12 if liHt liWid Printer PageHeight Printer PageWidth then begin Paper HEIGHT is constrained aspect ration Set printed bitmap with to be 76 of paper HEIGHT jPrintedImageHeight MulDiv Printer PageHeight 76 100 76 Set printed bitmap WIDTH to maintain aspect ratio iPrintedImageWidth liWid jPrintedImageHeight DIV

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/Printing/PrintJPEGTImage2.TXT (2016-02-14)
    Open archived version from archive


  • time I looked up how to print a bitmap in each of the books Here s what I found Teach Yourself Delphi 4 in 21 Days p 565 says to use Draw or StretchDraw Delphi 4 Bible p 557 says to use Draw p 558 559 says to use StretchDraw Mastering Delphi 4 p 982 says to use StretchDraw Delphi 4 Developer s Guide This info s on the CD

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0131.txt (2016-02-14)
    Open archived version from archive


  • an example it isn t exactly what you want but it s close enough enjoy Mat Procedure TCustomPlot PrintClick Description The public printing method Author Mat Ballard Date created 12 1 1999 Date modified 02 25 2000 by Mat Ballard Purpose Print the graph Known Issues We kludge this one a bit by creating a metafile then playing it on the printer canvas It would be nicer to draw directly on the printer canvas procedure TCustomPlot PrintClick Sender TObject var i Integer Copies Integer PrintDialog TPrintDialog PrintBorder TRect HorzSizeMM VertSizeMM Integer for the metafile AMetafile TMetafile begin Printer Orientation FPrintOrientation PrintDialog TPrintDialog Create Self PrintDialog Options poPrintToFile poWarning if PrintDialog Execute then begin if PrintDialog Copies 1 then Copies PrintDialog Copies else Copies 1 Printer Title Application ExeName FTitle Caption HorzSizeMM WinProcs GetDeviceCaps Printer Handle HORZSIZE VertSizeMM WinProcs GetDeviceCaps Printer Handle VERTSIZE Set the margins to 25 mm PrintBorder Left 25 Printer PageWidth div HorzSizeMM PrintBorder Top 25 Printer PageHeight div VertSizeMM PrintBorder Right Printer PageWidth PrintBorder Left PrintBorder Bottom Printer PageHeight PrintBorder Top AMetafile TMetafile Create delete some of my own stuff AMetafile LoadFromFile MyFile note the D4 TPrinter has a Copies property but not all printers support it

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2000/0410a.txt (2016-02-14)
    Open archived version from archive


  • IFDEF WIN32 type SpoolInt DWORD ELSE type SpoolInt integer ENDIF function StartRawPrintJob PrinterName pChar Port pChar DocName pChar THandle function StartRawPrintPage hPrn THandle integer function PrintRawData hPrn THandle Buffer pointer NumBytes SpoolInt integer function EndRawPrintPage hPrn THandle integer function EndRawPrintJob hPrn THandle integer implementation uses WinProcs IFDEF WIN32 WinSpool ELSE Print ENDIF function StartRawPrintJob PrinterName pChar Port pChar DocName pChar THandle IFDEF WIN32 var hPrn THandle DocInfo1 TDocInfo1 ENDIF begin IFDEF WIN32 if OpenPrinter PChar PrinterName hPrn nil FALSE then begin Result THandle 1 Exit end DocInfo1 pDocName DocName DocInfo1 pOutputFile Port DocInfo1 pDataType RAW if StartDocPrinter hPrn 1 DocInfo1 0 then begin Result THandle 1 exit end Result hPrn ELSE result OpenJob Port DocName 0 ENDIF end function StartRawPrintPage hPrn THandle integer begin IFDEF WIN32 if StartPagePrinter hPrn FALSE then begin Result 1 exit end result 1 ELSE result StartSpoolPage hPrn ENDIF end function PrintRawData hPrn THandle Buffer pointer NumBytes SpoolInt integer IFDEF WIN32 var BytesWritten DWORD ENDIF begin if NumBytes 0 then begin Result 1 exit end IFDEF WIN32 if WritePrinter hPrn Buffer NumBytes BytesWritten FALSE then begin Result 1 exit end if NumBytes BytesWritten then begin Result 1 exit end Result 1 ELSE result WriteSpool hPrn Buffer NumBytes ENDIF end function EndRawPrintPage hPrn THandle integer begin IFDEF WIN32 if EndPagePrinter hPrn FALSE then begin Result 1 exit end Result 1 ELSE result EndSpoolPage hPrn ENDIF end function EndRawPrintJob hPrn THandle integer begin IFDEF WIN32 if EndDocPrinter hPrn FALSE then begin Result 1 exit end if ClosePrinter hPrn FALSE then begin Result 1 exit end Result 1 ELSE result CloseJob hPrn ENDIF end end Example of use uses PrtRaw procedure TForm1 Button1Click Sender TObject var hPrn THandle Data array 0 31 of char begin hPrn StartRawPrintJob Generic Text Only LPT1 My Document if integer hPrn 0 then begin

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/Printing/JoeHechtPrtRaw.TXT (2016-02-14)
    Open archived version from archive


  • Epson Stylus Color S placeholder for size 2 blanks 27 reset 27 2 6 lines per inch 27 k 4 Script font 27 P 10 5 pt 1o cpi 27 l 10 left border at column 10 27 Q 70 right border at column 60 10 10 10 3 empty lines Hello printer 27 Ethis should be bold 27 F 27 4this should be italic 27 5 13 10 On

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/1030.txt (2016-02-14)
    Open archived version from archive



  •