Simple printing help
-
I have a textbox control whose multiline property is set to true. I have some text in that textbox control. For the first time I printed those textbox content program through my program. And secondly, when i copy that exact same content in the notepad, and printed it,it prints differently.I want to print those textbox content like the printing from the notepad. Do I have to change any setting in the textbox property so that the textbox content will be printed in the same way that the notepad prints? I think notepad automatically formats the spacing but the textbox control doesnot.So the textbox content doesnot print in the format that i want. I printing using the code: .......... e.Graphics.DrawString(txtPrnt.text, New Font("Tahoma", 8, FontStyle.Regular), Brushes.Black, e.MarginBounds.X, e.MarginBounds.Y) ...........
-
I have a textbox control whose multiline property is set to true. I have some text in that textbox control. For the first time I printed those textbox content program through my program. And secondly, when i copy that exact same content in the notepad, and printed it,it prints differently.I want to print those textbox content like the printing from the notepad. Do I have to change any setting in the textbox property so that the textbox content will be printed in the same way that the notepad prints? I think notepad automatically formats the spacing but the textbox control doesnot.So the textbox content doesnot print in the format that i want. I printing using the code: .......... e.Graphics.DrawString(txtPrnt.text, New Font("Tahoma", 8, FontStyle.Regular), Brushes.Black, e.MarginBounds.X, e.MarginBounds.Y) ...........
I am not very clear as what differences you see, however there would definitely be some difference between the print taken from an application like notepad and from a control like textbox. Any text editor has codes written behind it to format text before it is sent to the printer. Therefore if you need any specific type of formatting in text, you should – 1) Take text value of text box in a string object. 2) Perform whatever formatting you want on this string by writing your code. 3) Send this string object to the printer. I hope this clarifies the scenario. -Dave.
Dave Traister, ComponentOne LLC. www.componentone.com
-
I have a textbox control whose multiline property is set to true. I have some text in that textbox control. For the first time I printed those textbox content program through my program. And secondly, when i copy that exact same content in the notepad, and printed it,it prints differently.I want to print those textbox content like the printing from the notepad. Do I have to change any setting in the textbox property so that the textbox content will be printed in the same way that the notepad prints? I think notepad automatically formats the spacing but the textbox control doesnot.So the textbox content doesnot print in the format that i want. I printing using the code: .......... e.Graphics.DrawString(txtPrnt.text, New Font("Tahoma", 8, FontStyle.Regular), Brushes.Black, e.MarginBounds.X, e.MarginBounds.Y) ...........
As per this article[^] you need to pass a [b]StringTrimming[/b] class to the Graphics.DrawString call to get the text to wrap appropriately.
'--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd