Solved

Memo printing

Posted on 2000-04-04
7
297 Views
Last Modified: 2010-04-04
Hi there,
I have got a memo... max 10 lines. I have 3 printers installed on the computer. How do I print the contents of the Memo to a specific printer quickly ?
0
Comment
Question by:drnadeem
  • 3
  • 3
7 Comments
 
LVL 2

Expert Comment

by:aubs
ID: 2682987
Does it have to be a memo. If you change to a richedit, the is already a print method: richedit1.Print. Otherwise you will have to use the printer.canvas.textout method./

Toselect a particular printer

add printers to your uses clause

get the available printers from

printer.printers

assign the printer you want

printer.printerindex:= 1;

Regards

Aubs
0
 
LVL 17

Accepted Solution

by:
inthe earned 10 total points
ID: 2685467
Hi,

uses printers;

procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
printer.printerindex:= 1; //2 or 3
Printer.BeginDoc;
Printer.Canvas.Font.Style:= [fsBold, fsItalic];
Printer.Canvas.Font.Size:= 10;
for I := 0 to Memo1.Lines.Count -1 do
Printer.Canvas.TextOut(10, I * 100, Memo1.Lines[I]);
Printer.EndDoc;
end;

Regards Barry
0
 
LVL 1

Author Comment

by:drnadeem
ID: 2759581
How would I start to print the contents of the Memo after giving some blank lines from the top of the page ?
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 17

Expert Comment

by:inthe
ID: 2759937
above doesnt work for that ?
if i press return 4-5 times in a memo then do :
showmessage(inttostr(memo1.lines.count));
on a button click then it shows me "4" or "5" so the loop in the print function should count them as lines also..
0
 
LVL 1

Author Comment

by:drnadeem
ID: 2761427
sorry barry,
I wanted to do that automatically by sending a line feed or enter key to the printer. I suppose there may be other ways like setting the caret position and then adding a blank line to the memo. In this case caret position should be right at the top of the memo.

any ideas ?
0
 
LVL 1

Author Comment

by:drnadeem
ID: 2761439
Got it barry,
Thanks... any better ideas appreciated!!

Memo1.Lines.Insert(0, '   ');
0
 
LVL 17

Expert Comment

by:inthe
ID: 2762482
Hi,
i think that is probably the quickest way what you have posted.
i can think of other ways using sendmessage but they take more than one line of code.

0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi : could not find program, '...exe' 2 172
Delphi selector screen 2 80
delphi parse string to params 3 123
Tidtcpserver listening on multiports? 1 27
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question