TPrintPreview only in black&white

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

TPrintPreview only in black&white

Postby Bronius » September 29th, 2005, 1:05 pm

Hello,

Can You help me?
I'd like remove colors from PrintPreview using BeginEdit. Is it possible?

Bronius
Bronius
Active Member
Active Member
 
Posts: 11
Joined: August 26th, 2005, 12:16 pm

Postby Kambiz » September 29th, 2005, 2:29 pm

I have no idea! :roll:
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Bronius » October 13th, 2005, 8:17 pm

Hello, Kambiz,

I found solution of my black&white problem, but in result I loose quality.

In attachment there is sample project.
Can I ask You to take a look :oops: ?

May be, You have any idea...

Thank You!
-----------------------------------
Bronius
Attachments
Result.jpg
Preview in Black&White
Result.jpg (55.82 KiB) Viewed 1942 times
Source.jpg
Preview with colors
Source.jpg (56.52 KiB) Viewed 1942 times
Sample.zip
Sample project
(15.2 KiB) Downloaded 107 times
Bronius
Active Member
Active Member
 
Posts: 11
Joined: August 26th, 2005, 12:16 pm

Postby Kambiz » October 13th, 2005, 10:31 pm

Because of converting metafile to raster graphic, the lose of quality with a zoom factor other 100% is obvious.

By the way, the following code is more optimized.

Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
  BM: TBitmap;
begin
  Button1.Enabled := False;
  if PrintPreview1.BeginEdit(1) then
    try
      BM := TBitmap.Create;
      try
        BM.Width := PrintPreview1.Pages[1].Width;
        BM.Height := PrintPreview1.Pages[1].Height;
        BM.PixelFormat := pf1bit;
        BM.Canvas.Draw(0, 0, PrintPreview1.Pages[1]);
        PrintPreview1.Canvas.StretchDraw(PrintPreview1.PageBounds, BM);
      finally
        BM.Free;
      end;
    finally
      PrintPreview1.EndEdit;
    end;
end;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » October 21st, 2005, 10:35 pm

I think removing colors from a print out is a matter of the printer's driver. I mean, you can propably force your color printer to print on gray scale or black and white.

Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 3 guests

cron