下面是TStatusBar的一段源程序,请看:
procedure TStatusBar.CNDrawItem(var Message: TWMDrawItem);
var
SaveIndex: Integer;
begin
with Message.DrawItemStruct^ do
begin
SaveIndex := SaveDC(hDC);
FCanvas.Handle := hDC;
FCanvas.Font := Font;
FCanvas.Brush.Color := clBtnFace;
~~~~~~~~~~~~ 注意这里
FCanvas.Brush.Style := bsSolid;
DrawPanel(Panels[itemID], rcItem);
FCanvas.Handle := 0;
RestoreDC(hDC, SaveIndex);
end;
Message.Result := 1;
end;
因此,要达到你的目的看来如果不用OwnerDraw就只有直接改VCL源程序了.