Difference between revisions of "PrinterSetup.Width"

From Xojo Documentation

m
 
Line 16: Line 16:
  
 
<rbcode>
 
<rbcode>
Dim settings As String
+
Var settings As String
Dim p As New PrinterSetup
+
Var p As PrinterSetup
 +
p = New PrinterSetup
 
If p.PageSetupDialog Then
 
If p.PageSetupDialog Then
 
   settings = p.SetupString
 
   settings = p.SetupString
 
End If
 
End If
  
Label1.Text = "PageLeft=" + Str(p.PageLeft)
+
Label1.Value = "PageLeft=" + p.PageLeft.ToString
Label2.Text = "PageTop=" + Str(p.PageTop)
+
Label2.Value = "PageTop=" + p.PageTop.ToString
Label3.Text = "PageHeight=" + Str(p.PageHeight)
+
Label3.Value = "PageHeight=" + p.PageHeight.ToString
Label4.Text = "PageWidth=" + Str(p.PageWidth)
+
Label4.Value = "PageWidth=" + p.PageWidth.ToString
Label5.Text = "Height=" + Str(p.Height)
+
Label5.Value = "Height=" + p.Height.ToString
Label6.Text = "Width=" + Str(p.Width)
+
Label6.Value = "Width=" + p.Width.ToString
Label7.Text = "Computed height=" + Str(p.Height - 2 * p.PageTop)
+
Label7.Value = "Computed height=" + Str(p.Height - 2 * p.PageTop)
Label8.Text = "Computed width=" + Str(p.Width - 2 * p.PageLeft)
+
Label8.Value = "Computed width=" + Str(p.Width - 2 * p.PageLeft)
Label9.Text = "Horizontal resolution=" + Str(p.HorizontalResolution)
+
Label9.Value = "Horizontal resolution=" + p.HorizontalResolution.ToString
Label10.Text = "Vertical Resolution=" + Str(p.VerticalResolution)
+
Label10.Value = "Vertical Resolution=" + p.VerticalResolution.ToString
 
</rbcode>
 
</rbcode>

Latest revision as of 14:02, 26 July 2019

Read-Only Property (As Integer )
IntegerValue = aPrinterSetup.Width

Supported for all project types and targets.

The width of the printable area on the page in pixels. The width is the PageWidth minus the margins.

Example

This example displays the Page Setup box and then displays the page size, printable area, and margins in Label controls. Results, of course, depend on the page size that the user selects. Since PageLeft and PageTop are the horizontal and vertical margins as measured from the printable area rather than the edge of the page, they are negative.

Var settings As String
Var p As PrinterSetup
p = New PrinterSetup
If p.PageSetupDialog Then
settings = p.SetupString
End If

Label1.Value = "PageLeft=" + p.PageLeft.ToString
Label2.Value = "PageTop=" + p.PageTop.ToString
Label3.Value = "PageHeight=" + p.PageHeight.ToString
Label4.Value = "PageWidth=" + p.PageWidth.ToString
Label5.Value = "Height=" + p.Height.ToString
Label6.Value = "Width=" + p.Width.ToString
Label7.Value = "Computed height=" + Str(p.Height - 2 * p.PageTop)
Label8.Value = "Computed width=" + Str(p.Width - 2 * p.PageLeft)
Label9.Value = "Horizontal resolution=" + p.HorizontalResolution.ToString
Label10.Value = "Vertical Resolution=" + p.VerticalResolution.ToString