diff --git a/lcl/include/buttonglyph.inc b/lcl/include/buttonglyph.inc index c4f3da0430..86307b6305 100644 --- a/lcl/include/buttonglyph.inc +++ b/lcl/include/buttonglyph.inc @@ -38,12 +38,13 @@ Function TButtonGlyph.Draw(Canvas: TCanvas; const Client: TRect; var gWidth : integer; gHeight : integer; + DestRect: TRect; begin // for default assume only 1 glyph gWidth := TPixMap(FOriginal).Width; gHeight := TPixMap(FOriginal).Height; - Result := Rect(0, 0, gWidth - 1, gHeight - 1); + Result := Rect(0, 0, gWidth, gHeight); if NumGlyphs > 1 then begin @@ -60,8 +61,13 @@ begin Result := Rect(0, 0, gWidth - 1, gHeight - 1); end; + DestRect:=Client; + inc(DestRect.Left,Offset.X); + inc(DestRect.Right,Offset.X); + inc(DestRect.Top,Offset.Y); + inc(DestRect.Bottom,Offset.Y); if not Transparent then - Canvas.Copyrect(Client, TPixmap(FOriginal).Canvas, Result) + Canvas.Copyrect(DestRect, TPixmap(FOriginal).Canvas, Result) else ; end; diff --git a/lcl/include/speedbutton.inc b/lcl/include/speedbutton.inc index 6b2a204394..98dedbfb42 100644 --- a/lcl/include/speedbutton.inc +++ b/lcl/include/speedbutton.inc @@ -290,6 +290,10 @@ begin Offset.X := 0; Offset.Y := 0; end; + inc(Offset.X,(PaintRect.Right-PaintRect.Left + -TButtonGlyph(FGlyph).Glyph.Width) div 2); + inc(Offset.Y,(PaintRect.Bottom-PaintRect.Top + -TButtonGlyph(FGlyph).Glyph.Height) div 2); //this needs to be done yet. Assert(False,'Trace:TODO: DRAWTEXTBIDIMODEFLAGS'); @@ -522,6 +526,9 @@ end; { ============================================================================= $Log$ + Revision 1.9 2001/07/03 10:30:32 lazarus + MG: speedbuttonglyph centered, buttonglyph border fixed + Revision 1.8 2001/06/14 14:57:58 lazarus MG: small bugfixes and less notes