Autor Beitrag
Sledge_Hammer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 98 SE, Win XP
D7 Prof
BeitragVerfasst: Di 08.10.02 16:04 
Hi
Ich bin grad dabei ein prog zu schreiben bei dem ich etwas auf den canvas zeichne. wenn jetzt aber das fenster meines programmes von einem anderen fenster überdeckt wird und danach wieder vollständig zum vorschein kommt, ist der gesamte bereich der überdeckt war gelöscht, das heißt meine zeichnung ist gelöscht und der bereich ist wieder grau.
ich hoffe ihr versteht was ich meine!
und eine kurze frage hätte ich noch: wie kann ich den ganzen bereich oder teile daraus drucken?
THX Benni
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mi 09.10.02 00:22 
Erstell eine TBitmap Variable mit den Koordinaten von ClientHeight und ClientWidth des Formulars. Zeichne was du zeichnen willst auf der Bitmap. Setze in OnPaint Prozedur des Formulars eine Kopierfunktion die die Bitmap auf das Formular überträgt.

Andrers gehts leider nicht.

Ich hab mal schnell ein Beispiel gezaubert:

ausblenden volle Höhe 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:
var
  Form1: TForm1;
  Bmp: TBitmap;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Bmp := TBitmap.Create;
  Bmp.Canvas.Brush.Color := clYellow;
  Bmp.Width := ClientWidth;
  Bmp.Height := ClientHeight;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  Bmp.Free;
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  Canvas.Draw(0, 0, Bmp); //Draw oder was besseres
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Bmp.Canvas.Rectangle(10, 20, 300, 400); //Als Beispiel wird ein Rechteck gezeichnet
  FormPaint(Self); //Nach jeder wichtigen Aktion Bitmap wieder übertragen
end;
Sledge_Hammer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 98 SE, Win XP
D7 Prof
BeitragVerfasst: Mi 09.10.02 10:19 
Hi
Danke für die Hilfe. Werd ich mal probieren. Ich denk mal so werd ich das auch mit dem drucken hinkriegen.
THX Benni
Criz
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18

Win XP Prof.
D6 Ent, D7 Ent
BeitragVerfasst: So 19.01.03 14:43 
Hi,
Probier's mit der Paintbox.. :D
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: So 19.01.03 18:23 
@Criz: Hast du schon mal auf das Datum des Postings geschaut?

_________________
Ist Zeit wirklich Geld?
Rool
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 211



BeitragVerfasst: So 19.01.03 21:19 
Titel: nebenbei...
ähhh... mit ner paintbox ist es das gleiche!!!
man muss wenn schon ein TImage nehmen!!!

_________________
MFG Rool