Platforms to show: All Mac Windows Linux Cross-Platform
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/Window Colors
This example is the version from Sat, 3rd May 2019.
Project "Window Colors.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control Canvas2 Inherits Canvas
ControlInstance Canvas2 Inherits Canvas
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Control Label4 Inherits Label
ControlInstance Label4 Inherits Label
End Control
Control Canvas3 Inherits Canvas
ControlInstance Canvas3 Inherits Canvas
End Control
Control Canvas4 Inherits Canvas
ControlInstance Canvas4 Inherits Canvas
End Control
Control Label5 Inherits Label
ControlInstance Label5 Inherits Label
End Control
Control Label7 Inherits Label
ControlInstance Label7 Inherits Label
End Control
EventHandler Sub Close()
const COLOR_WINDOW = 5
const COLOR_ACTIVECAPTION = 2
// restore
call WinSetSysColorMBS(COLOR_WINDOW, WindowColor)
call WinSetSysColorMBS(COLOR_ACTIVECAPTION, ActiveCaptionColor)
End EventHandler
EventHandler Sub Open()
const COLOR_WINDOW = 5
const COLOR_ACTIVECAPTION = 2
WindowColor = WinGetSysColorMBS(COLOR_WINDOW)
ActiveCaptionColor = WinGetSysColorMBS(COLOR_ACTIVECAPTION)
canvas1.Backdrop = P( WindowColor)
canvas2.Backdrop = P(ActiveCaptionColor )
if WinSetSysColorMBS(COLOR_WINDOW, &c880000) then
if WinSetSysColorMBS(COLOR_ACTIVECAPTION, &cFF0000) then
label7.Text = "OK"
else
label7.Text = "Active caption failed"
end if
else
label7.Text = "Color window failed"
end if
canvas3.Backdrop = P( WinGetSysColorMBS(COLOR_WINDOW))
canvas4.Backdrop = P( WinGetSysColorMBS(COLOR_ACTIVECAPTION))
End EventHandler
Function P(c as color) As Picture
System.DebugLog "color: "+str(c)
dim r as new Picture(40, 20, 32)
r.Graphics.ForeColor = c
r.Graphics.FillRect 0, 0, 40, 20
Return r
End Function
Property ActiveCaptionColor As color
Property WindowColor As color
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
End Project
See also:
The items on this page are in the following plugins: MBS Win Plugin.