![]() |
Re: Images Arrays zuordnen!
Zitat:
![]() |
Re: Images Arrays zuordnen!
x:=1
y:=2 Z:=3 w:=4 auch für image1 schreiben kann image(x+4*i) i ist die schleife for i........ 0 to 6 könnt ihr mir noch kurz sagen ob das geht? und dann noch wie ich das const array in var definiere |
Re: Images Arrays zuordnen!
Delphi-Quellcode:
Ein konstantes Array in einer Var definieren? :gruebel:
FindComponent('Image' + inttostr(x+4*i))
Oder meinst Du sowas?
Delphi-Quellcode:
var Bilder: array[0..5] of string;
begin Bilder[0] := 'Blau'; Bilder[1] := 'Gruen'; ... end; |
Re: Images Arrays zuordnen!
var
Form1: TForm1; array[0..5] of string; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin const Bilder: array[0..5] of string = ('Blau','Rot','Gruen','Gelb','Braun','Orange'); begin {RadioButton1} Image1.Picture.LoadFromFile(Bilder[RadioGroup1.ItemIndex] + '.bmp'); {RadioButton2} Image2.Picture.LoadFromFile(Bilder[RadioGroup2.ItemIndex] + '.bmp'); {RadioButton3} Image3.Picture.LoadFromFile(Bilder[RadioGroup3.ItemIndex] + '.bmp'); {RadioButton4} Image4.Picture.LoadFromFile(Bilder[RadioGroup4.ItemIndex] + '.bmp'); end; end; procedure TForm1.Button3Click(Sender: TObject); begin close end; end. so hab ich das jetzt gemacht aber das funktioniert nicht! |
Re: Images Arrays zuordnen!
Was bedeutet, funktioniert nicht?
|
Re: Images Arrays zuordnen!
declaration expected but const found
und lacht mich nicht aus aber ich bin nun mal nen total noob |
Re: Images Arrays zuordnen!
vor dem const kommt kein begin
|
Re: Images Arrays zuordnen!
Zitat:
Delphi-Quellcode:
das
const
Delphi-Quellcode:
weg und nach
begin
Delphi-Quellcode:
auch..dann solltes es gehen!
image4.....
|
Re: Images Arrays zuordnen!
Danke schonmal aber es geht immer noch nicht:
Project Logiktrainer.exe raised exception class EAccessViolation with message 'Access violation at address 00403EC4 in modul 'Logiktrainer.exe'. Write of address 0057008F'. Process stopped. Use Step or Run to continue. diese meldung kommt dann var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); const Bilder: array[0..5] of string = ('Blau','Rot','Grün','Gelb','Braun','Orange'); begin {RadioButton1} Image1.Picture.LoadFromFile(Bilder[RadioGroup1.ItemIndex] + '.bmp'); {RadioButton2} Image2.Picture.LoadFromFile(Bilder[RadioGroup2.ItemIndex] + '.bmp'); {RadioButton3} Image3.Picture.LoadFromFile(Bilder[RadioGroup3.ItemIndex] + '.bmp'); {RadioButton4} Image4.Picture.LoadFromFile(Bilder[RadioGroup4.ItemIndex] + '.bmp'); end; procedure TForm1.Button3Click(Sender: TObject); begin close end; end. und so sieht das Programm jetzt aus |
Re: Images Arrays zuordnen!
Bei welchem Index?
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:57 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz