View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0038865||Lazarus||LCL||public||2021-05-08 00:59||2021-05-19 13:04|
|Reporter||Zaher Dirkey||Assigned To|
|Platform||Windows||OS||Windows 8.1 64 bit|
|Summary||0038865: TSpeedButton autosize with margin|
|Description||Put SpeedButton1 on the form, use|
SpeedButton1.Caption := 'Speed Button';
SpeedButton1.AutoSize := True;
SpeedButton1.Margin := 5;
TSpeedButton calculate the size correctly in MeasureDraw but when painting it, it shifted by PaintBackground(PaintRect) (line about 855 in speedbutton.inc), because PaintBackground change Left (and Right) or PaintRect, when painting by theme, come from windows theme uxTheme.dll
to resolve it
procedure PaintBackground(var PaintRect: TRect); virtual;
procedure PaintBackground(PaintRect: TRect); virtual;
but idk how that will effects on other thing, it is need the maintainer to fix it.
|Tags||No tags attached.|
|Fixed in Revision|
I can't check Delphi, but if I read some comments, Delphi behaves the same and it is not a bug, but a feature.
See e.g.: https://stackoverflow.com/questions/4549885/easiest-way-to-print-caption-of-speedbutton-and-button-on-the-same-line
> The Margin property does change the left margin of a TSpeedButton's caption, but only when the Layout property is set to
> blGlyphLeft, which it is set to by default. Change Layout to either blGlyphTop or blGlyphBottom, and you will be able to adjust,
> correspondingly, the top or the bottom margin of the caption.
It is with AutoSize of TSpeedButton, I checked Delphi there is no AutoSize in Delphi TSpeedButton
it calculate the size wrong or let me say it calc it correct in measuring, but paint wrong in painting
At least it is counter intuitive: autosize is supposed to size the button so that it is at all time large enough for the glyph+caption.
IMO this should also work if Margin is set.
||B.t.w. TBitBtn seems to have the same issue.|
|2021-05-08 00:59||Zaher Dirkey||New Issue|
|2021-05-08 00:59||Zaher Dirkey||File Added: SpeedButtonAutoSize.png|
|2021-05-15 20:05||Michl||Note Added: 0130907|
|2021-05-15 20:50||Zaher Dirkey||Note Added: 0130910|
|2021-05-19 13:02||Bart Broersma||Note Added: 0130957|
|2021-05-19 13:04||Bart Broersma||Note Added: 0130958|