Finding myself unexpectedly released from jury duty for a couple of days I knocked up this desktop only library. I am rather pleased with it (he said modestly). It is compiled for .NET 2.0 but the source is provided and should compile without change under .NET 1.1.
It uses a RichTextBox to provide nicely laid out printed pages with choice of colour, font and alignment. Page setup, preview and print are provided and pagination is automatic. I am still looking to see if manual page breaks can be provided. The printing is based on some code I found in MSDN.
In normal use I envisaged that the RichTextBox would be made invisible and just used to build the document - the example enclosed keeps it visible. If you want to add events use my ControlEvents library and the ControlRef property of the RichTextBoxDesktop.
It is a work in progress and ultimately I will provide a help file. Please try it and post any suggestions for improvement.
EDIT :- Version 1.6 posted with CutSelectionToClipboard and CopySelectionToClipboard methods added. Help file updated.
EDIT :- Version 1.7 posted. Has WordWrap and Scrollbars properties added and a dummy library for the device. Help file updated. Sources for merging posted in separate zip file.
EDIT:- Version 1.8 allows user formatting and editing of text. See post #67.
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
My Posts helped you? Consider Buying me a Porto Glass!
I don't think that I can take this library any further. This version 1.1 adds vertical offset for sub and superscripts, hanging indent at paragraph start, right and left (or both) indented text and bullets, tabs and new page.
The control background colour may be set, and the plain text and rtf formatted text obtained.
Text and bitmaps may be pasted from the clipboard.
Help file to follow once I get motivated to do it.
Pre 5.80 B4PPC will see some capitalised objects in the library - ignore them. 5.80 won't show them. Thanks Erel!
EDIT: Forgot the source. It is now included in the zip file.
Hi Agraham,
This library came as a blessing to me, just what i needed great work
I have a question:
how can I get the program to print without the printer selection screen coming up, I am using a program as a print spooler and i dont want any user intervention. (The print server has no keyboard or screen)
It must print to default printer and it is mainly text
how can I get the program to print without the printer selection screen coming up,
I will post a version that will let you do this do this later today.
Quote:
Originally Posted by giannimaione
is it possible to control PrintPreview methods?
example: maximaze form ; select value of Zoom
I can give you Top and Left (position on screen), Height and Width (size) and WindowState (normal, minimised & maximised) later today. I can't easily do anymore as this dialog is designed for user interaction not program control.