Autor Beitrag
Jenny
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 05.04.03 15:22 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.b_zeichneClick(Sender: TObject);
begin
  with Image1.canvas do
  begin
   pen.color:=clRed;
   MoveTo(10, 10: Integer);
   LineTo(10, 50: Integer);

  end;
end;


bei moveto meckert der rum und meint ')' erwartet aber ':' gefunden :roll:
ich versteh nich was da falsch is... steht sogar in der hilfe so...

und ich hab noch ne frage... muss ich ers die farbe auswählen und dann den strich ziehn oder andersrum? :mrgreen:

danke :)

Jenny

Moderiert von user profile iconUGrohne: Quote-Tags durch Code-Tags ersetzt!
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Sa 05.04.03 15:29 
Ui, da ist dir die Syntax von Pascal selber noch überhaupt nicht klar... :)

MoveTo(10,10);

Muss das heißen.

Und du setzt erst die Farbe und dann malst du. :)
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: Sa 05.04.03 15:29 
Zum 2. als erstes: Es ist richtig rum so, erst die Farbe, dann den Strich, da der Strich ja draufgezeichnet wird und nicht als neues Objekt erstellt (kannst also danach nicht mehr einfach drauf zugreifen.

Zu Deinem Code: Das :integer musst Du weglassen, in der Hilfe steht nur, wie die Variable innerhalb der Prozedur heißt und welchen Typ sie hat, in dem Fall integer. Du musst nur
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.b_zeichneClick(Sender: TObject); 
begin 
  with Image1.canvas do 
  begin 
   pen.color:=clRed; 
   MoveTo(10, 10: Integer); 
   LineTo(10, 50: Integer); 
  end; 
end;

schreiben, dann funktionierts.

P.S.:Verwende in Zukunft bitte Code-Tags für Quellcode statt Quote-Tags. Ich glaube, bei Dir hab ich das schonmal korrigiert. Nur als Hinweis :wink:

//Nachtrags@alibi: Es kann sich nur um Sekunden gehandelt haben *g*
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 05.04.03 15:32 
upsala :mrgreen:

vielen dank :)
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 05.04.03 15:36 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.b_clearClick(Sender: TObject);
begin
  with Image1.Canvas do
  begin
    FillRect(ClipRect);
    Brush.color:=clwhite;
  end;
end;

procedure TForm1.b_zeichneClick(Sender: TObject);
begin
  with Image1.canvas do
  begin
   brush.color:=clRed;
   rectangle(10,10,50,50);

  end;
end;


öhm... also erstens wieso ist um das rectangle bei mir automatisch ne schwarze umrandung drum? und zweitens warum wird alles rot wenn ich auf den clear-button klick? :roll:
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Sa 05.04.03 15:43 
ausblenden Quelltext
1:
2:
3:
4:
5:
  with Image1.canvas do
  begin
   brush.color:=clRed;
   fillrect(rect(10,10,50,50));
  end;

Ergibt ein Rechteck ohne Rand.
Und beim Zweiten: Wie gesagt, erst musst du die Farbe setzen, mit der du auch malen willst. :)
Du nimmst ja bei Filzstiften auch erst die richtige Farbe in die Hand, mit der du dann auch malen willst und nicht umgekehrt. :)
Einfach die beiden Zeilen umdrehen.
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 05.04.03 15:46 
ups :oops: man bin ich doof... voll peinlich hier :mrgreen:
dankesehr für eure geduld :lol:
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Sa 05.04.03 15:49 
Wieso peinlich? Ist doch egal, hauptsache du feuerst das nicht frustiert in die Ecke. ;)
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: Sa 05.04.03 15:53 
Rectangle zeichnet ein Rechteck mit Brush.Color als Inhalt und Pen.Color als Umrandung. Du musst also noch Pen.Color verändern oder Pen.Style auf psClear setzen.
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 05.04.03 18:37 
Alibi hat folgendes geschrieben:
Wieso peinlich? Ist doch egal, hauptsache du feuerst das nicht frustiert in die Ecke. ;)


das mach ich auch gleich :mrgreen: ich weiss schon was ich nächstes halbjahr nich mehr schriftlich nehme :!: sche*** klausurstress :shock: