set the background color of a themed StatusBar component
How can I set the background color of a themed TStatusBar
component? When I set the color property, it only works if the Enabled r开发者_如何学运维untime themes
is disabled.
thanks in advance.
Not sure if this is exactly what you require, but you could simply disable the Theme Painting for a specific control, in this case your Statusbar, like so:
Uses
uxTheme;
SetWindowTheme(StatusBar1.Handle, '', '');
You can write your own OwnerDraw-Event and draw the StatusBar (to be precise: every Panel on it!) with your own colors:
procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
begin
with StatusBar.Canvas do begin
Brush.Color := clRed;
FillRect(Rect);
TextOut(Rect.Left, Rect.Top, 'Panel '+IntToStr(Panel.Index));
end;
end;
But with themes on it is not possible to change the color in the Object-Inspector.
精彩评论