Delphi-PRAXiS
Seite 1 von 3  1 23   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Bild in eine Buttonkomponente?? (https://www.delphipraxis.net/108658-bild-eine-buttonkomponente.html)

STS301 17. Feb 2008 12:37


Bild in eine Buttonkomponente??
 
Liste der Anhänge anzeigen (Anzahl: 1)
hi

bin gerade dabei eine Buttonkomponente zu erstellen, ich will allerdings (falls dies möglich ist) ein Bild statt zb. im Anhang einen Kreis als Button verwenden.

mit loadfromFile und LoadBitmap funktioniert es nicht, muss ich da einen eigenen Dateityp verwenden oder funktionieren solche Sachen grundsätzlich nicht?

hier ist einmal ein Auszug aus dem Kreisbutton

Delphi-Quellcode:
procedure TOButton.Paint;
var i: Integer;
begin
  // Position für Anzeige von Caption
  x := (Width - Canvas.TextWidth(Caption)) div 2;
  y := (Height- Canvas.TextHeight(Caption)) div 2;
  // OButton gedrückt
  if Pressed then
    for i := 1 to 3 do
    begin
      // Canvas.Pen.Color := OColor[4-i];      
      Canvas.Pen.Color := OColor[(i+1) div 2];    //statt den paar zeilen ein Bild einfügen
      Canvas.Arc (i, i, Width-i, Height-i, i, i, i, i);
      Canvas.Ellipse (3, 3, Width-3, Height-3);
      Canvas.TextOut (x+1,y+1, Caption+' ');
    end
  // OButton nicht gedrückt
  else
    for i := 1 to 3 do
    begin
      Canvas.Pen.Color := OColor[i];
      Canvas.Arc (i, i, Width-i, Height-i, i, i, i, i);//hier genau so
      Canvas.Ellipse (3, 3, Width-3, Height-3);
      Canvas.TextOut (x,y, Caption+' ');
    end;
end;

sirius 17. Feb 2008 13:28

Re: Bild in eine Buttonkomponente??
 
Und der TBitButton reicht dir nicht?

STS301 17. Feb 2008 13:29

Re: Bild in eine Buttonkomponente??
 
naja, ich will eher eine eigene Buttonform (das Bild) und nicht ein Bild im Button

STS301 18. Feb 2008 14:09

Re: Bild in eine Buttonkomponente??
 
kann mir wirklich keier helfen?

Landfloh 18. Feb 2008 14:14

Re: Bild in eine Buttonkomponente??
 
Ich würd auch sagen der TBitButton sonst kenn ich nichts. :|

STS301 18. Feb 2008 14:39

Re: Bild in eine Buttonkomponente??
 
das heißt sonst muss man den Button mit Canvas zeichnen, oder wie sonst?

sieht bei den AlphaSkinButtons ziemlich schwierig aus es nur mit Canvas zu machen?

rollstuhlfahrer 18. Feb 2008 17:55

Re: Bild in eine Buttonkomponente??
 
ne andere version ist die Image-Komponente, die auch angeklickt werden kann. Wenn man das Image auf Transpartent schaltet kanns auch wie ein Button aussehen. Nur der Klick wird auch dann gehaldelt, wenn er nicht auf dem Bild ist...

rollstuhlfahrer

STS301 18. Feb 2008 18:10

Re: Bild in eine Buttonkomponente??
 
das möchte ich ja vermeiden

hat sonst keiner eine Idee??

DeddyH 18. Feb 2008 18:14

Re: Bild in eine Buttonkomponente??
 
Du könntest das Image laden, abscannen und Dir eine region zusammenbasteln, aber das ist alles Andere als trivial.

HalloDu 18. Feb 2008 18:18

Re: Bild in eine Buttonkomponente??
 
Vor kurzem erst hat doch jemand einen runden Button geschrieben. Hier


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:02 Uhr.
Seite 1 von 3  1 23   

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