There's no WM_CTLCOLOR message in the native api. Instead you can use CN_CTLCOLORSCROLLBAR control notification, which is send to child controls by the VCL in response to the API's WM_CTLCOLORSCROLLBAR.
type TScrollBar = class(TScrollBar) protected procedure WMCtlColor(var Message: TWMCtlColorScrollbar); message CN_CTLCOLORSCROLLBAR; end; procedure TScrollBar.WMCtlColor(var Message: TWMCtlColor); begin Message.Result := CreateSolidBrush(RGB(255, 255, 0)); end;
Or, if you don't want to derive a new control, provided the scrollbar is placed on the form:
TForm1 = class(TForm) ... protected procedure WMCtlColorScrollbar(var Message: TWMCtlColorScrollbar); message WM_CTLCOLORSCROLLBAR; ... end; procedure TForm1.WMCtlColorScrollbar(var Message: TWMCtlColorScrollbar); begin if Message.ChildWnd = ScrollBar1.Handle then Message.Result := CreateSolidBrush(RGB(255, 255, 0)); end;