Inhalt von RichEdit drucken?
-
Hi Leute!
Finde leider nirgendwo eine Info, habt ihr vielleicht eine Idee wie ich formatierten RichEdit-Text (also mit Farben und Textformatierungen) auf einem Drucker drucken kann?? Ist das sehr schwierig? Leider kenne ich mich nicht gut mit Druckern aus, bisher habe ich nur die PopPrntPrintFile-Funktion aus dem Petzold aber die hilft mir da auch nicht weiter.
Oder kennt ihr gute Tutorials mit brauchbaren Druckfunktionen???
Gruss,
code_pilot
-
Beim Drucken zeichnest du doch im Prinzip nur auf einen anderen DC, oder
-
WM_PRINT
-
Öhm ja ... aber ich will ja nicht das Control printen sondern den Text :p ... verstehe euch nicht ganz...
-
Ich kann dir nur mit dem aus der MSDN-Library dienen:
Printing
You can send messages to a rich edit control to render its output for a specified device, such as a printer. You can also specify the output device for which a rich edit control formats its text.
To format part of a rich edit control's contents for a specific device, you can use the EM_FORMATRANGE message. The FORMATRANGE structure used with this message specifies the range of text to format as well as the device context for the target device.
After formatting text for an output device, you can send the output to the device by using the EM_DISPLAYBAND message. By repeatedly using the EM_FORMATRANGE and EM_DISPLAYBAND messages, an application that prints the contents of a rich edit control can implement banding. (Banding is the division of output into smaller parts for printing purposes.)
You can use the EM_SETTARGETDEVICE message to specify the target device for which a rich edit control formats its text. This message is useful for WYSIWYG formatting, in which an application positions text using the default printer's font metrics instead of the screen's.
Das ist ein Auszug von MSDN: About Rich Edit Controls
-
Yay!
Habe mal ein bisschen gegoogled, und dabei folgendes Top-Tutorial für den C++Builder gefunden :p
http://home.att.net/~robertdunn/Papers/REPnP1.html
http://home.att.net/~robertdunn/Papers/REPnP2.html
http://home.att.net/~robertdunn/Papers/REPnP3.html
und der Sourcecode dazu (BCB 4): http://home.att.net/~robertdunn/CodeSamples/RichEditPnP40.zipVor allem: Die Druckfunktion selber ist knapp 100 Zeilen lang
Zwar habe ich das vom C++Builder Code (der ein bisschen VCL verwendet) abgeleitet, und es hapert auch noch am Seitenwechsel und der Positionierung (der Text erscheint recht mittig auf der Seite), doch prinzipiell geht's, der Inhalt des RichEdit wird original WYSIWYG geprinted!Danke
~code_pilot