Solved

TRichedit and Graphics

Posted on 1998-09-29
8
243 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 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

12 Experts available now in Live!

Get 1:1 Help Now