Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TRichedit and Graphics

Posted on 1998-09-29
8
Medium Priority
?
254 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
  • 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 150 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Independent Software Vendors: 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!

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…
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 summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

773 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