Solved

Memo printing

Posted on 2000-04-04
7
294 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

20 Experts available now in Live!

Get 1:1 Help Now