Solved

TRichedit and Graphics

Posted on 1998-09-29
8
250 Views
Last Modified: 2010-04-06
Hi,

i have a RTF-file and will it print. i do it this way:
load the RTF-File in a TricheditField and print it with the print-Method. This works fine.
But if in the RTF-file is a graphic, the graphic will not be printed.
the graphic may be simple, just a bitmap.

How can i print the whole RTF-File inclusive the graphic ?
thanks
titz
0
Comment
Question by:titz
[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
  • 4
  • 3
8 Comments
 
LVL 10

Expert Comment

by:Jacco
ID: 1341091
The TRichEdit component doesn't support that... You have to use another component. There are some around on the net that do support OLE objects.

I myself use WPTools.

Good luck

Regards Jacco
0
 
LVL 1

Author Comment

by:titz
ID: 1341092
hi jacco,

if it's not possible : is there a chance to print the Tricheditfield (without using the print-method) ?
i think, i will first print the grahic (by using BITBLT) and then print the text. But how is to interpret the TTextattributes of the text ?

titz

0
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
ID: 1341093
How about this????

procedure TForm1.Button1Click(Sender: TObject);
   var
          DC : hDC;
begin
          Image1.Canvas.Brush.Color := Color;
          Image1.Canvas.FillRect(Image1.Canvas.ClipRect);
          DC := GetDC(RichEdit1.Handle);
          BitBlt(Image1.Canvas.Handle,0,0,Width, Height, DC,0,0, SRCCOPY);
          ReleaseDC(RichEdit1.Handle, DC);
          //Print the image.....
end;

All you need to do where it says print the image is to print it with some technique.....Tell me if oyu need more help in order to get this done...... It will print the text and the graphic as a whole...

Regards,
Viktor Ivanov
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:titz
ID: 1341094
Hi viktor,

your idea is nice and it works.
But ... the printing is very small .
i suppose, you will print the image.canvas with the bitblt-function. Then the size will be abot two centimeters !!
printing with stretchblt is a very bad quality.
do you have another idea for printing ??
regards,
titz
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1341095
Use the Canvas.StretchDraw()....

//Vik
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1341096
Example.....

Make the R(Rect) as large as you want and then strecth the original image to that so you can get a large picture on your printer.....

var
  ScaleX, ScaleY : integer;
  R : TRect;
begin
  Printer.BeginDoc; //**
  with Printer do
  try
    ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
    ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;  
    R := Rect(0, 0, Image1.Picture.Width * ScaleX, Image1.Picture.Height * ScaleY);
    Canvas.StretchDraw(R, Image1.Picture.Graphic); //**
  finally
    EndDoc; //**
  end;
end;

Do you see the //** ?? Don't remove those....

Regards,
Viktor Ivanov
0
 
LVL 1

Author Comment

by:titz
ID: 1341097
thanks viktor,
it helps .
But the quality of the printing is nor very good for you can see the pixles.

regards
titz

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1341098
Sorry, I'm not very much into graphics printing, and especially quality pf graphics...Still young and got many things to learn ;->

Regards,
Viktor Ivanov
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
When I am typing into a TEdit last word repeats 7 179
Delphi XE10 Round Image 2 231
Delphi problems to abort a printjob 9 51
Using MMsystem To change audio input 1 40
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…
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

752 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