Autor Beitrag
Shadowdragon
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 143

Win 2000
Delphi 6 Pers., Delphi 7
BeitragVerfasst: Mo 03.03.03 15:35 
Hallo!
Also. Ich habe vor, mir mit 2 Grafiken einen Button zu erstellen.
Am Anfang steht, sagen wir mal, grafik1.jpg. Dies ist der Button in der Ursprungsform.

Wenn der User jetzt auf den Button drückt, soll anstelle der grafik1.jpg die grafik2.jpg dargestellt werden, welche den Button im gedrückten Zustand anzeigt.

Nun meine Frage:

Wie kann ich beide Grafiken in Delphi importieren, sodass sie beim Wechsel nicht immer auf den Pfad der einen Datei und dann wieder auf den der anderen springen muss? (Das Ganze wird mit OnClick realisiert)

Und wie mache ich das codeweise am besten?

Danke!

_________________
Ein Programm gleicht dem Prinzip von Jenga:
Viele Bestandteile, wird nach oben hin immer besser, nach unten hin immer instabiler und wenn man was falsch macht klappt der ganze Mist zusammen.
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 03.03.03 15:37 
Einfach die beiden Bilder als Resource einbinden, einfach im Forum suchen, da gibts schon einige Threads dazu.

Gruß
Shadowdragon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 143

Win 2000
Delphi 6 Pers., Delphi 7
BeitragVerfasst: Mo 03.03.03 15:40 
Danke :) alles was ich wissen wolt.

_________________
Ein Programm gleicht dem Prinzip von Jenga:
Viele Bestandteile, wird nach oben hin immer besser, nach unten hin immer instabiler und wenn man was falsch macht klappt der ganze Mist zusammen.
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mo 03.03.03 15:40 
Du kompilierst beide Grafiken in eine *.res Datei. Dann erwartest du auf deinem Image ein OnMouseDown, bzw. OnMouseUp Ereigniss und änderst mit
ausblenden Quelltext
1:
Image1.Picture.Bitmap.Handle := LoadBitmap(hInstance, 'Name in der *.res Datei');					

die Grafik (hier eine Bitmap).

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mo 03.03.03 15:41 
Da war wohl jemand schneller.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 03.03.03 15:45 
Ja, so etwa 3 MInuten, hast halt zu lange an Deinem Code gebastelt :wink:

Gruß
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 03.03.03 16:51 
Shadowdragon hat folgendes geschrieben:
... soll anstelle der grafik1.jpg die grafik2.jpg dargestellt werden, ...


Ich würde es mit Bitmap machen. Dann hast du weniger Arbeit.