Platforms to show: All Mac Windows Linux Cross-Platform

/Main/Canvas and Retina


You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Canvas and Retina

This example is the version from Sat, 3rd May 2019.

Project "Canvas and Retina.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if not TargetCocoa then MsgBox "Cocoa target required for Retina on Mac." end if End EventHandler
End Class
Class Window1 Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) draw g, 1 End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Canvas2 Inherits Canvas
ControlInstance Canvas2 Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) dim p as new Picture(g.Width * 2, g.Height * 2, 32) dim gg as Graphics = p.Graphics draw gg, 2 g.drawpicture p, 0, 0, g.width, g.height, 0, 0, p.width, p.Height End EventHandler
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Sub Draw(g as Graphics, factor as integer) g.ForeColor = &c000000 g.TextSize = 18*factor g.DrawString "Hello World", 20*factor ,20*factor g.ForeColor = &cFF0000 g.PenWidth = 5*factor g.PenHeight = 5*factor g.DrawLine 30*factor, 30*factor, 200*factor, 200*factor g.ForeColor = &c000000 g.PenHeight = 1 g.PenWidth = 1 // fine line g.DrawLine 30 * factor, 50*factor, 100*factor, 50*factor End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
SetRetina
End SetRetina
End Project

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


The biggest plugin in space...