Solved

TRichedit and Graphics

Posted on 1998-09-29
8
251 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

617 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