Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Memo printing

Posted on 2000-04-04
7
Medium Priority
?
302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 30 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

715 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