Platforms to show: All Mac Windows Linux Cross-Platform
/Win/Printing/Windows Print Dialogs
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/Windows Print Dialogs
This example is the version from Sun, 17th Mar 2012.
Project "Windows Print Dialogs.xojo_binary_project"
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()
call p.PageSetupDialog
End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
dim g as Graphics = OpenPrinterDialog(p)
if g<>nil then
g.DrawString "Hello World", 100, 100
end if
End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action()
call w.PrinterProperties(Self)
End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action()
call w.ConnectToPrinterDialog(Self)
End EventHandler
End Control
Control PushButton5 Inherits PushButton
ControlInstance PushButton5 Inherits PushButton
EventHandler Sub Action()
dim i as WindowsDeviceModeMBS
dim o as WindowsDeviceModeMBS
call w.DocumentProperties(i, o, true, self)
End EventHandler
End Control
Control PushButton6 Inherits PushButton
ControlInstance PushButton6 Inherits PushButton
EventHandler Sub Action()
dim i as WindowsDeviceModeMBS
dim o as WindowsDeviceModeMBS
call w.AdvancedDocumentProperties(i, o, self)
End EventHandler
End Control
Control PushButton7 Inherits PushButton
ControlInstance PushButton7 Inherits PushButton
EventHandler Sub Action()
dim d as new WindowsPageSetupDialogMBS
d.Parent = self
d.Flags = d.PSD_DEFAULTMINMARGINS
call d.PageSetupDialog
End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control PushButton8 Inherits PushButton
ControlInstance PushButton8 Inherits PushButton
EventHandler Sub Action()
dim d as new WindowsPrintDialogMBS
d.Parent = self
d.Flags = d.PD_ALLPAGES or d.PD_USEDEVMODECOPIESANDCOLLATE or d.PD_NOPAGENUMS
d.MinPage = 1
d.MaxPage = 10
call d.PrintDialogEx
End EventHandler
End Control
Control PushButton9 Inherits PushButton
ControlInstance PushButton9 Inherits PushButton
EventHandler Sub Action()
dim d as new WindowsPrintDialogMBS
d.Parent = self
d.Flags = d.PD_ALLPAGES or d.PD_USEDEVMODECOPIESANDCOLLATE or d.PD_NOPAGENUMS or d.PD_PRINTSETUP
d.MinPage = 1
d.MaxPage = 10
call d.PrintDialog
End EventHandler
End Control
Control PushButton10 Inherits PushButton
ControlInstance PushButton10 Inherits PushButton
EventHandler Sub Action()
dim d as new WindowsPrintDialogMBS
d.Parent = self
d.Flags = d.PD_ALLPAGES or d.PD_USEDEVMODECOPIESANDCOLLATE or d.PD_NOPAGENUMS
d.MinPage = 1
d.MaxPage = 10
call d.PrintDialog
End EventHandler
End Control
EventHandler Sub Open()
p = new PrinterSetup
w = new WindowsPrinterMBS(WindowsPrinterMBS.GetDefaultPrinter)
End EventHandler
Property p As PrinterSetup
Property w As WindowsPrinterMBS
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
See also:
The items on this page are in the following plugins: MBS Win Plugin.