Solved

TRichedit and Graphics

Posted on 1998-09-29
8
246 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
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

770 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