|
The caption of the speedbutton is originally centered. It may be that the font or button height is not adjusted.
Created a TButtonGlyph class in the create of speedbutton
This class can be used to adjust the appearance behavior
There is a private member method under this class
procedure TButtonGlyph.DrawButtonText (Canvas: TCanvas; const Caption: string;
TextBounds: TRect; State: TButtonState; BiDiFlags: LongInt);
begin
with Canvas do
begin
Brush.Style: = bsClear;
if State = bsDisabled then
begin
OffsetRect (TextBounds, 1, 1);
Font.Color: = clBtnHighlight;
DrawText (Handle, PChar (Caption), Length (Caption), TextBounds,
DT_CENTER or DT_VCENTER or BiDiFlags);
OffsetRect (TextBounds, -1, -1);
Font.Color: = clBtnShadow;
DrawText (Handle, PChar (Caption), Length (Caption), TextBounds,
DT_CENTER or DT_VCENTER or BiDiFlags);
end else
DrawText (Handle, PChar (Caption), Length (Caption), TextBounds,
DT_CENTER or DT_VCENTER or BiDiFlags);
end;
end; |
|