: Hello All
: I got a very nice piece of Delphi code the other day from the web, http://www.tipps.delphi-source.de/oberflaeche/tut20030208-4.shtml
: I needed to print out the contents of a String Grid, this works great, but I want to know if anyone knows how to print the lines as well which are around the cells.
: So what I want to do is to print an exact copy of the String grid (except the Colour) and all its cells and the lines around the cells.
: Thanks in advance
You need to add this line into the i-j for-loops at the end of the page printing:
Printer.Canvas.Rectangle(XPos, YPos, XPos+Grid.ColWidths[J]*3, YPos+ZeilenSize);
This should draw a rectangle around the cell, although I'm not sure. Here is a way to make a print-preview: place a TPaintBox onto a form and copy the print-code into a second event (a button or menu item OnClick for example). Then change the word Printer into the name of the paintbox. This will "print" the last page onto the paintbox. If you want to preview the other pages, just remove the p for-loop and let the users select a page index "P".