Autor Beitrag
Bronstein
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 578
Erhaltene Danke: 1

WIN XP
Delphi 6 / Delphi 2006 / Delphi XE
BeitragVerfasst: Fr 06.07.07 17:02 
Ich habe ein kleines Problem, bin einfach noch Anfänger was Bilder angeht.
Ich habe auf meinem Formular ein TImage und zwei Button.

Wenn ich auf einen Button klick soll die Bildgröße und die Farbe geändert werden.

Beim ersten mal funktioniert das auch.
Drücke ich dann auf den zweiten Button wird zwar die Farbe geändert, die Größe des Bildes aber nicht:
ausblenden 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:
procedure BildZeichnen(Farbe: TColor; Breite, Hoehe: Integer);
var
  Rect: TRect;
begin
  Form1.Image1.Width := Hoehe;
  Form1.Image1.Height := Breite;

  Rect.Left := 0;
  Rect.Right := Breite;
  Rect.Top := 0;
  Rect.Bottom := Hoehe;
  Form1.Image1.Canvas.Brush.Color := Farbe;

  Form1.Image1.Canvas.FillRect(Rect);
  Form1.Image1.Refresh;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  BildZeichnen(clRed, 50, 50);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
   BildZeichnen(clGreen, 100, 150);
end;

_________________
Es gibt keine dummen Fragen nur dumme Antworten!!!
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Fr 06.07.07 18:58 
ausblenden Delphi-Quelltext
1:
2:
  Rect.Width := Breite;
  Rect.Height := Hoehe;


??
Robinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 275

WinXP
BDS 2006
BeitragVerfasst: Fr 06.07.07 19:07 
user profile iconAndreas L. hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
  Rect.Width := Breite;
  Rect.Height := Hoehe;


??


????

_________________
erare humanum est