Delphi32.com - Home!
| Home/News | Downloads | Forums | D32 Magazine | Resources | Info and Facts |  
 
 How do I print in color?


How do I print in color?   

    Generally, no special effort is required to print in color assuming the printer is a color printer and is set to its native color mode. Windows will automatically convert color to black and white if the printer does not support color. If you need to change the color mode in code, you can access the DevMode structure of the printer driver. Example:

    uses Printers;
    procedure TForm .Button Click(Sender: TObject);
    var
      Device : array[0..255] of char;
      Driver : array[0..255] of char;
      Port   : array[0..255] of char;
      hDMode : THandle;
      PDMode : PDEVMODE;
    begin
      with Printer do begin
        PrinterIndex := PrinterIndex;
        GetPrinter(Device, Driver, Port, hDMode);
        if hDMode <> 0 then begin
          pDMode := GlobalLock(hDMode);
          if pDMode <> nil then begin
            pDMode.dmFields := pDMode.dmFields or dm_Color;
            pDMode.dmColor := DMCOLOR_COLOR;
            GlobalUnlock(hDMode);
          end;
        end;
        PrinterIndex := PrinterIndex;
        BeginDoc;
        Canvas.Font.Color := clRed;
        Canvas.TextOut( 00, 00, 'Red As A Rose!');
        EndDoc;
      end;
    end;
    
     


  << Previous Faq     Complete List     Next Faq >>  



 
 Hits/month  2,500,000+ 
 Downloads
 (Since May 2000)
 7,393,709 
 Total Files  6,023 
 Forum msgs  7,670 
 Articles/FAQs  70+/900+ 
Kylix
Tips n Tricks
FAQs
Knowledge Base
Bug Listings
Articles
Books
Newsgroups
Links
Submissions
Testimonials
Advertising
Contact Us
About Us
Search Amazon:
Top Selling Software at Amazon

| Home/News | Downloads | Forums | Resources | Info and Facts | Testimonials |
  Site Search:
 


Comments/Problems: Webmaster@delphi32.com
Copyright © 1998-2006, Delphi32.com. All rights reserved.
Terms of Use