I have discovered that the issue is to do with the default unit settings in the Graphics class, as described in
http://msdn.microsoft.com/en-us/library/ms535812(v=vs.85).aspx[
^]
You need to use the following line of code to set it to pixels.
g.SetPageUnit(UnitPixel);
That now works in XPS and on the real printer.
[edit]
Using old-style GDI rather than GDI+, the following code works fine:
HANDLE hPen = CreatePen(PS_SOLID, 60, RGB(255, 0, 0)); SelectObject(pdx.hDC, hPen);
Rectangle(pdx.hDC, 0, 0, pageWidth, pageHeight);
[/edit]