Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Printing/Advanced printing on Windows
Function:
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Printing/Advanced printing on Windows
This example is the version from Sun, 17th Mar 2012.
Project "Advanced printing on Windows.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() dim g as Graphics = OpenPrinterDialog if g = nil then Return dim factor as Double = 1 // when changing printer settings, the resolution is reset to native for i as integer = 1 to 3 if i = 2 then // 2nd page in landscape dim mode as new WindowsDeviceModeMBS mode.Fields = mode.DM_ORIENTATION mode.Orientation = mode.DMORIENT_LANDSCAPE if not g.WinEndPageMBS then MsgBox "Endpage failed" end if if not g.WinApplyDevModeMBS(Mode) then MsgBox "Failed to apply settings." end if if not g.WinStartPageMBS then MsgBox "Startpage failed." end if // calculate what factor we need to continue with 72 dpi layout raster dim info as WindowsGraphicsInfoMBS = g.WindowsGraphicsInfoMBS factor = info.LogPixelsX/72 elseif i = 3 then // 3rd page in custom format dim mode as new WindowsDeviceModeMBS mode.Fields = mode.DM_ORIENTATION+mode.DM_PAPERWIDTH + mode.DM_PAPERLENGTH mode.Orientation = mode.DMORIENT_PORTRAIT mode.PaperWidth = 3000 // 30 cm mode.PaperLength = 1000 // 10 cm if not g.WinEndPageMBS then MsgBox "Endpage failed" end if if not g.WinApplyDevModeMBS(Mode) then MsgBox "Failed to apply settings." end if if not g.WinStartPageMBS then MsgBox "Startpage failed." end if end if g.TextSize = 20*factor g.ForeColor = &c00000 g.DrawString "Hello World: "+str(i), 40*factor, 40*factor g.DrawLine 0, 0, g.Width*factor, g.Height*factor next End EventHandler
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Win Plugin.





Links
MBS Xojo Chart Plugins