Autor Beitrag
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Do 27.04.06 11:43 
die top-eigenschaft nicht vom i abhängig machen?

Gruß Frank
chriss1988
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 389

windows xp prof,home,windows98
delphi5
BeitragVerfasst: Do 27.04.06 11:47 
ja danke habs schon

nun noch eine frage

wollte 10 pics in eine zeile

also 5 zeilen a10 bilder

wiemuss ich das machen weil immoment schreibt der mir die 50 bilder hintereinander
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Do 27.04.06 11:58 
hab sowas mal ohne mehrere images gemacht:

procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
const
abstand=20;
Zeilen=5;
begin
for i:=1 to 50 do
canvas.Draw(((i-1)div Zeilen) *Abstand,((i-1)mod Zeilen) *Abstand,image1.picture.graphic);
end;

sollte dir trotzdem helfen
PS: das -1 brauchst du, da dein array bei 1 beginnt

Gruß Frank
master_tom Threadstarter
Hält's aus hier
Beiträge: 15

Win XP
Delphi 7
BeitragVerfasst: Do 27.04.06 12:01 
hm naja ich habs jetzt anders gemacht da ich statt auf eine antwort zu warten lieber die shapes von hand gemacht habe geht das ejtzt und der code damit das ding vorwärts geht geht auch =o

_________________
Eigentlich bin ich ganz anders aber ich komme so selten dazu.
chriss1988
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 389

windows xp prof,home,windows98
delphi5
BeitragVerfasst: Do 27.04.06 12:11 
so habs jetzt so müsste es gehn

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var i:integer;
const abstand=90;
      Zeilen=5;
begin
for i:=1 to 50 do
canvas.Draw(((i-1)div Zeilen) *Abstand,((i-1)mod Zeilen)*Abstand,image1.picture.graphic);
end;
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Do 27.04.06 12:16 
Probiert das mal so:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
    images : array[1..50] of TIMage;
    procedure ChangeImage(Sender : TObject);
  public
    { Public-Deklarationen }

  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.ChangeImage(Sender : TObject);
begin
  if sender is TImage then
    TImage(Sender).Picture.LoadFromFile('C:\red.bmp');

end;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=1 to 50 do
  begin
    Images[i]:=TImage.Create(self);  // Erst Create, dann alles andere
    with Images[i] do
    begin
      Parent:=Self;
      Name:='im_'+IntToStr(i);  // Name wäre evtl sinnvoll

      Width:=15;
      Height:=15;

      // wir erstellen nun 5 reihen a 10 spalten

      Left:=(((i-1) MOD 10) *20) + 0; // Um alles zu verschieben statt +0 irgendeinen
      Top:=(((i-1) DIV 10)*20) + 0 ;  // anderen Wert eintragen
 
      // Standardgrafik laden
      Picture.LoadFromFile('C:\green.bmp');

      // OnClick Prozedur hinzufügen
      OnClick := ChangeImage;
    end;
  end;
end;

end.


edit: von der Lösung von _frank_ möchte ich abraten. du erstellt ja schon TIMages, warum dann dieser Umweg? Bewege einfach das TImage an die gewünschte Position und zeige es an. (siehe code in diesem post)

_________________
Delphi: XE - OS: Windows 7 Professional x64
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Do 27.04.06 13:04 
user profile iconHorschdware hat folgendes geschrieben:
Probiert das mal so:
edit: von der Lösung von _frank_ möchte ich abraten. du erstellt ja schon TIMages, warum dann dieser Umweg? Bewege einfach das TImage an die gewünschte Position und zeige es an. (siehe code in diesem post)


mein Beispiel war auch nur eines zur Berechnung der Position, ich würde nicht dutzende TImages erzeugen, sondern ein array (oder liste) einer Feldklasse/Feld-Record definieren, die felder per canvas-methoden malen, nummer drauf und evtl. ein flag für einen Leiterstatus. dann die Leitern je nach Leiterstatus:
sowas in der Richtung:

if gotoID>0 then
begin
if curid>gotoID then
blitz(gotoID)
else
leiter(gotoID)
end;

eine ID von <0 sagt dass keine leiter/blitz angezeigt wird

Gruß Frank
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Do 27.04.06 13:06 
Alles klar ^^
Hab mal wieder falsch gedacht.

Je nach Situation ist deine Methode sogar besser:
Wenn man davon ausgeht dass alle oder viele Felder die gleiche Grafik bekommen sollen,
dann kannst du dir es sparen 50 mal das gleiche Bild zu laden.
Einfach einmal laden und mit canvas.draw auf dem formular verteilen

_________________
Delphi: XE - OS: Windows 7 Professional x64
master_tom Threadstarter
Hält's aus hier
Beiträge: 15

Win XP
Delphi 7
BeitragVerfasst: Do 27.04.06 13:28 
ich hab es jetzt newbiesh gemacht und jedes shape einzeln eingesetzt und jetzt gehtz =D sogar das spiel himself geht ^^

werde es nachher noch z ippen und hier aufschalten damit ihr was zu lachen habt (vom code her ;D )

_________________
Eigentlich bin ich ganz anders aber ich komme so selten dazu.
chriss1988
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 389

windows xp prof,home,windows98
delphi5
BeitragVerfasst: Do 27.04.06 13:45 
warum zulachen haupsache das ding geht und mann kann noch erkennen was dein gedanken gang ist /war
master_tom Threadstarter
Hält's aus hier
Beiträge: 15

Win XP
Delphi 7
BeitragVerfasst: Do 27.04.06 14:35 
so ich bin fast fertig fehlt nur noch eine message box wo steht "Wollen Sie noch einmal Spielen" mit antwort Ja und Nein bei Ja soll die Form resetet werden (wie bei nem reset button den ich auch gemacht habe) und bei nein soll die form geschlossen werden

_________________
Eigentlich bin ich ganz anders aber ich komme so selten dazu.
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Do 27.04.06 14:38 
ausblenden Delphi-Quelltext
1:
2:
if (MessageDlg('Nochmal?',mtconfirmation,[mbyes,mbno],0) = mryes) then
    ShowMessage('OK!');

_________________
Delphi: XE - OS: Windows 7 Professional x64
master_tom Threadstarter
Hält's aus hier
Beiträge: 15

Win XP
Delphi 7
BeitragVerfasst: Do 27.04.06 14:39 
ja genau sowas aber gibt es keine möglichkeit dann direkt zu sagen reset oder direkt zu sagen close ?

_________________
Eigentlich bin ich ganz anders aber ich komme so selten dazu.
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Do 27.04.06 14:44 
naja, was genau willst du denn resetten?
solange du es nicht implementiert hast, solange hat dein programm keine vorstellung was ein reset sein soll.

edit: close kannst du natürlich machen - dann beendet sich aber in aller regel dein programm ^^

_________________
Delphi: XE - OS: Windows 7 Professional x64
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Do 27.04.06 14:46 
Wo ist das Problem?

if (MessageDlg('Nochmal?',mtconfirmation,[mbyes,mbno],0) = mryes) then
resetGame
else
close;

resetgame stellt dabei halt deine Ausgangslage wieder her...

Frank
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Do 27.04.06 14:48 
keine ahnung wo das problem sein soll.
die resetgame prozedur muss jetzt halt geschrieben werden.
aber einfach so gibt es keine vorgefertigte reset methode.

_________________
Delphi: XE - OS: Windows 7 Professional x64
master_tom Threadstarter
Hält's aus hier
Beiträge: 15

Win XP
Delphi 7
BeitragVerfasst: Do 27.04.06 14:56 
ich habs grad gesehen habs jetzt so gemacht dass man wenn man ja drückt entweder die anderen noch selber fertigspielen können oder man halt selber auf reset drücken muss


Mal nur die exe den rest bring ich irgednwie ned daruf alles zusammen ist zu gross ^^
Einloggen, um Attachments anzusehen!
_________________
Eigentlich bin ich ganz anders aber ich komme so selten dazu.


Zuletzt bearbeitet von master_tom am Do 27.04.06 15:00, insgesamt 2-mal bearbeitet
chriss1988
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 389

windows xp prof,home,windows98
delphi5
BeitragVerfasst: Do 27.04.06 14:58 
stellstdus auch hier rein???
master_tom Threadstarter
Hält's aus hier
Beiträge: 15

Win XP
Delphi 7
BeitragVerfasst: Do 27.04.06 15:01 
ahja dann halt 2 downloads der zweite ist jetzt das projekt ohne exe ^^

die exe könnt ihr ja mit delphi selber machen oder halt von dem oberen beitrag herunterladen Oo
Einloggen, um Attachments anzusehen!
_________________
Eigentlich bin ich ganz anders aber ich komme so selten dazu.
chriss1988
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 389

windows xp prof,home,windows98
delphi5
BeitragVerfasst: Do 27.04.06 15:05 
[Fataler Fehler] main.pas(6): Datei nicht gefunden: 'Variants.dcu'???