Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Speedbutton + Canvas (https://www.delphipraxis.net/52683-speedbutton-canvas.html)

LoL 1. Sep 2005 15:31


Speedbutton + Canvas
 
hi

Ich weis dieses Theme hatten wir schon :mrgreen:
Ich hab den Code von hier.

Wenn ich nun folgendes mache,
Delphi-Quellcode:
var bmp: TBitmap;
begin
  try
    bmp := TBitmap.Create;
    bmp.Width := SpeedButton1.Width -4;
    bmp.Height := SpeedButton1.Height -4;
    bmp.Canvas.Pen.Color := clgreen;
    bmp.Canvas.FillRect(Rect(0, 0, bmp.Width, bmp.Height));
    SpeedButton1.Glyph.Assign(bmp);
  finally
    bmp.Free;
  end;
bleibt der Speedbutton trotzdem so grau wie vorher :gruebel:
Was mache ich falsch?

NicNacMan 1. Sep 2005 16:47

Re: Speedbutton + Canvas
 
keine ahnung wieso, aber bei mir gehts nur mit Rect(1, 1, bmp.Width, bmp.Height)
und natürlich brush.color statt pen.color
Delphi-Quellcode:
bmp := TBitmap.Create;
try
  bmp.Width := SpeedButton1.Width -4;
  bmp.Height := SpeedButton1.Height -4;
  bmp.Canvas.Brush.Color := clgreen;
  bmp.Canvas.FillRect(Rect(1, 1, bmp.Width, bmp.Height));
  SpeedButton1.Glyph.Assign(bmp);
finally
  bmp.Free;
end;

Muetze1 1. Sep 2005 18:11

Re: Speedbutton + Canvas
 
Moin!

Wenns mit 1, 1 geht, dann ist vermutlich die Transparenz Schuld, weil im Auto Modus wird der linke unterste Pixel als Transparenzfarbe genutzt und meiner Meinung nach steht in der Hilfe zu Glyph beim SpeedButton irgendwas zur Transparenz...

MfG
Muetze1

LoL 2. Sep 2005 14:08

Re: Speedbutton + Canvas
 
Danke!

Das ist zwar eine Lösung aber optisch fängt das Bild leider nicht ganz oben links an. :?
Naja ich versuche daran noch ein wenig herum zu spielen...


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:33 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz