🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #293

Re: Trouble converting code from Delphi to C#

#293
From: Jon Shemitz
Date: Tue, 17 Jan 2006 22:50
34 lines
2422 bytes
> I'm having trouble converting the following printing code from Delphi to
> C#.  The code takes a couple of fields and prints them on a label.
> Here's the code:
> 
>         Printer.Orientation := poLandscape;
> 
>         If Not Printer.Printing Then
>         begin
>                 Printer.BeginDoc;
>           {Print part num}
>                 Printer.Canvas.Font.Name := 'Arial';
>                 Printer.Canvas.Font.Size := 10;
>                 Printer.Canvas.Font.Style := [fsBold];
>                 Printer.Canvas.TextOut(3, 30, 'Part: '+'1234567890123456789012645');
>           {Print lot}
>                 Printer.Canvas.Font.Style := [];
>                 Printer.Canvas.TextOut(3, 80, 'Lot: '+'01');
>           {Print Qty}
>          Printer.Canvas.TextOut(3, 120, 'Qty: '+'100');
>           {Print date}
>                 Printer.Canvas.Font.Style := [];
>                 Printer.Canvas.TextOut(475, 30, 'Scrap Date:');
>                 Printer.Canvas.TextOut(465, 70, SysDate);
>                 Printer.EndDoc;
>         end;
>         Printer.PrinterIndex := DefaultPrinter;

Take a look at the PrintDocument component. It has a PrintPage event
that allows you to specify page settings; draw to a supplied Graphics
(much like a Paint event); and specify whether there are any more
pages.

-- 
	<http://www.midnightbeach.com>
Technical Details
Message-ID: <43CD74A5.2FEBD141@midnightbeach.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news.glorb.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43cd5e11$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,871854c3e1c75cc1
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
Message-ID: <43CD74A5.2FEBD141@midnightbeach.com>
Date: Tue, 17 Jan 2006 14:50:13 -0800
From: Jon Shemitz <jon@midnightbeach.com>
Reply-To: jon@midnightbeach.com
Organization: Midnight Beach
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
X-Accept-Language: en-US,en
MIME-Version: 1.0
Newsgroups: borland.public.csharpbuilder.language.csharp
Subject: Re: Trouble converting code from Delphi to C#
References: <43cd5e11$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 63.249.87.157
X-Trace: newsgroups.borland.com 1137538052 63.249.87.157 (17 Jan 2006 14:47:32 -0700)
Lines: 34
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news.glorb.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail