uses ComCtrls;
function GetMaxTextWidth(Btn: TsSpeedButton): integer;
var
iGlyphWidth, iMargin: integer;
begin
with Btn do begin
if (Glyph <> nil) then
iGlyphWidth := Glyph.Width div NumGlyphs
else
if Assigned(Images) then
iGlyphWidth := Images.Width div NumGlyphs
else
iGlyphWidth := 0;
if Margin < 0 then
iMargin := 0
else
iMargin := Margin + 3;
Result := Width – 16 * integer(ButtonStyle = tbsDropDown) – iGlyphWidth – Spacing * integer((iGlyphWidth > 0) and (Caption <> '')) – iMargin * 2;
end;
end;