Autor Beitrag
Green
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

Windows XP Home
Delphi 6 Enterprise
BeitragVerfasst: So 30.12.07 22:07 
Hallo,

ich habe zwei Canvas TempCanvas, DrawImage: TCanvas
Jetzt wird zu Laufzeit der DrawImage die TempCanvas zugewiesen.
ausblenden Delphi-Quelltext
1:
DrawCanvas := TempCanvas;					

Die DrawCanvas ist teil eines TImage
ausblenden Delphi-Quelltext
1:
DrawCanvas := Image1.Canvas;					


jetzt wird aber nach dem zuweisen der Canvas diese nicht angezeigt, also im Image sieht man immer noch die alte Canvas...

was muss man da machen?

lG Green
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: So 30.12.07 22:11 
Gabs da ne sowaas wie Image1.Refresh oder so?

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Green Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

Windows XP Home
Delphi 6 Enterprise
BeitragVerfasst: So 30.12.07 22:14 
Tut nich...schon probiert...
genau so wenig wie Image.Repaint...

Ich zeichne einfach in einer Routine auf diese DrawCanvas und da funktionierts auch.
Jetzt will ich aber die DrawCanvas mit einer anderen austauschen und da haperts...
DrRzf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 260

Win XP Prof
D7 Enterprise
BeitragVerfasst: So 30.12.07 23:02 
solltest du dann nicht das picture übergeben ? bzw die Bitmap ?
zur not mit Assign
ausblenden Delphi-Quelltext
1:
 DingensCanvas.Picture := AndresDingensCanvas.Picture;					

_________________
rein statistisch gesehen darf man keiner statistik trauen die man nicht selbst gefälscht hat.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: So 30.12.07 23:29 
Dritte Möglichkeit:
Ich mache es immer mit CopyRect.
ausblenden Delphi-Quelltext
1:
Bitmap1.Canvas.CopyRect(Rect(00, Bitmap1.Width, Bitmap1.Height), Bitmap2.Canvas,Rect(00, Bitmap1.Width, Bitmap1.Height));					
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 02.01.08 03:39 
Moin!

user profile iconGreen hat folgendes geschrieben:
was muss man da machen?
Ich würde das so machen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
  var
    Temp: TBitmap;
begin
  Temp := TBitmap.Create; // Objekt anlegen
  try // was auch passiert...
    Temp.Pixelformat := pf24Bit; // Farbtiefe
    Temp.Width := Image1.Width; // und Größe
    Temp.Height := Image1.Height; // setzen
    with Temp.Canvas do begin // zeichnen
      Brush.Color := clMoneyGreen; // Hintergrundfarbe
      FillRect(ClipRect); // Hintergrund füllen
      Pen.Color := clWhite; // Vordergrundfarbe
      MoveTo(0,0); // Stiftposition setzen
      LineTo(Temp.Width,Temp.Height); // Linie zeichnen
    end;
    Image1.Picture.Bitmap.Assign(Temp); // Bild zuweisen
    Image1.Invalidate; // neuzeichnen auslösen
  finally // ...auf jeden Fall
    Temp.Free; // das Objekt wieder freigeben
  end;

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.