Most printer can not print "edge-to-edge". Although there is not an easy way to find the exact unprintable area in .Net you can come very close.
See: PrintPageEventArgs. Graphics. VisibleClipBounds You can divide the Width (and height) by two to approximate the non-printable area. In your case I would assume the Width would be 25 (1/4 of an inch). Petzold's book has a good description on this issue. FYI: ignore VisibleClipBounds when using the .Net print preview code. --- Jeff Roberts <[EMAIL PROTECTED]> wrote: > I have posted this on the WIN_FORMS list and gotten > no reply, can someone please help ? > > I am porting an advanced printing application from > win32 MFC C++ to C# .NET. I am having trouble > positioning text on a printed page at a specific > location. My application supports margins and > prints in the Graphics.PageUnit Pixel mode. My > application uses the page dimensions in pixels, the > horizontal and vertical resolutions, and the > Graphics.MarginBoundries to determine where to start > printing on the page. The code is ported from win32 > and calculates the X,Y location properly, however, > the printout always gets shifted about 2/16 of an > inch. For example, my printer has a horizontal > resolution of 300 dpi, the MarginBounds.Left > property (area unprintable on left side of page) is > 100, if I do a DrawString at location 200,200, then > I would expect the string to be printed exactly 1 > inch (300 pixels) from the left side of paper. It > is always prints 1 2/16 of an inch from the left > side of the paper ! WHY ? When I do the same > thing under WIN32, it prints exactly 1" from the > left. > > private void PrintLine(string s,PrintEventArgs ev) > { > ev.Graphics.PageUnit = GraphicsUnit.Pixel; > ev.Graphics.TextRenderingHint = TextQuality; > ev.Graphics.PixelOffsetMode = > PixelOffsetMode.None; > > StringFormat drawFormat = new > StringFormat(); > drawFormat.Alignment = StringAlignment.Near; > > ev.Graphics.DrawString(s, printFont, > ForgroundColor, 200,200, drawFormat); > } > > Any help would be greatly appreciated, I am ready to > toss the printer out the window ! I have tried > everything. > > thank you > > You can read messages from the Advanced DOTNET > archive, unsubscribe from Advanced DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. __________________________________________________ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos & More http://faith.yahoo.com You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.