Platforms to show: All Mac Windows Linux Cross-Platform

/Win/DirectDraw Line Drawing


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/DirectDraw Line Drawing

This example is the version from Fri, 11th Jun 2020.

Project "DirectDraw Line Drawing.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Output Inherits Canvas
ControlInstance Output Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) dim startCap as Integer = StartCapPopupMenu.ListIndex dim endCap as Integer = EndCapPopupMenu.ListIndex dim dashCap as Integer = DashCapPopupMenu.ListIndex dim lineJoin as Integer = LineJoinPopupMenu.ListIndex dim miterLimit as Single = 5 dim dashStyle as Integer = DashStylePopupMenu.listIndex dim dashOffset as Single = 0 dim Dashes() as Single dim point0x as double = 20 dim point0y as double = 20 dim point1x as double = output.Width - 20 dim point1y as double = output.Height - 20 dim strokeWidth as single = 5 dim red as single = 1.0 dim green as single = 0.0 dim blue as single = 0.0 dim alpha as single = 0.5 if dashStyle = 5 then // custom dashes.Append 5 dashes.Append 3 end if dim d as new DirectDrawGraphicsMBS(g) dim r1, r2 as boolean r1 = d.CreateSolidColorBrush(red, green, blue, alpha) // full blue 'r1 = d.CreateSolidColorBrush(&c0000FF00) r2 = d.CreateStrokeStyle(startCap, endCap, dashCap, lineJoin, miterLimit, dashStyle, dashOffset, Dashes) d.strokeWidth = strokeWidth d.DrawLine point0x, point0y, point1x, point1y End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control StartCapPopupMenu Inherits PopupMenu
ControlInstance StartCapPopupMenu Inherits PopupMenu
EventHandler Sub Change() output.Invalidate End EventHandler
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control EndCapPopupMenu Inherits PopupMenu
ControlInstance EndCapPopupMenu Inherits PopupMenu
EventHandler Sub Change() output.Invalidate End EventHandler
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Control DashCapPopupMenu Inherits PopupMenu
ControlInstance DashCapPopupMenu Inherits PopupMenu
EventHandler Sub Change() output.Invalidate End EventHandler
End Control
Control Label4 Inherits Label
ControlInstance Label4 Inherits Label
End Control
Control LineJoinPopupMenu Inherits PopupMenu
ControlInstance LineJoinPopupMenu Inherits PopupMenu
EventHandler Sub Change() output.Invalidate End EventHandler
End Control
Control Label5 Inherits Label
ControlInstance Label5 Inherits Label
End Control
Control DashStylePopupMenu Inherits PopupMenu
ControlInstance DashStylePopupMenu Inherits PopupMenu
EventHandler Sub Change() output.Invalidate End EventHandler
End Control
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

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


The biggest plugin in space...