Solved

Memo printing

Posted on 2000-04-04
7
295 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

947 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now