From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Shared Method


New in 2019r2

Supported on Desktop.

The system's window background color.


result = Color.FillColor

Part Type Description
result Color The color used for drawing the background of controls and windows.


This value is useful when you are using Canvas controls to create custom controls. When drawing objects, use this color to fill the background.

This value can be changed by the user or when the system changes between light and dark modes, so you should use this method in the Paint event handler rather than storing the value.

FillColor matches the default Window Background on all platforms, except for macOS in DarkMode. Use Graphics.ClearRectangle to properly clear the window so that it's background color displays when using Dark Mode.

Sample Code

This example uses the system fill color to set the color of a square with a 3D "raised" look. The code is in the Paint event of a Canvas.

Const White = &cffffff
Const DarkGray = &c8c8c8c

g.DrawingColor = White
g.DrawLine(1, 1, Me.Width, 1)
g.DrawLine(1, Me.Height - 1, 1, 1)
g.DrawingColor = DarkGray
g.DrawLine(Me.Width - 1, 2, Me.Width - 1, Me.Height)
g.DrawLine(1, Me.Height - 1, Me.Width, Me.Height - 1)

// Fill in using the system Fill color
g.DrawingColor = Color.FillColor
g.FillRectangle(2, 2, Me.Width - 3, Me.Height - 3)

See Also

Color for a complete list of functions; DesktopCanvas, Graphics classes; UserGuide:Dark Mode topic.