Autor Beitrag
en!gma
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: So 31.07.05 19:36 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
    cnv.Draw(10,10,bild);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
bild := TBitmap.Create;
cnv := TCanvas.Create;
bild.LoadFromFile('bild.bmp');
end;


wieso will er das nicht machen?
er soll doch nur das bild zeichnen alle x sec

muss das bitmap create denn in den timer?
also dann funktioniert es, aber wenn ich jedesmal das bild neu lade im timer, zieht das dann nicht unheimlich viel cpu?

mfg

en!gma

Moderiert von user profile iconAXMD: Code- durch Delphi-Tags ersetzt.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 31.07.05 19:41 
Wieso verwendest du nicht CopyRect oder BitBlt?

AXMD
en!gma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: So 31.07.05 19:43 
ich weiss nicht.
das war die einzig mir bekannte möglichkeit oben :D

//edit

hmm funzt CopyRect denn auch mit transparenten bereichen?
und mom zu BitBlp muss ich nochmal schnell suchen
en!gma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: So 31.07.05 20:00 
könnt ich villeicht ein beispiel für BitBlt haben?
und warum geht das denn oben nicht.
macht irgendwie keinen sinn : /

naja ich such mal weiter zum thema BitBlt
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 31.07.05 20:06 
Hallo

warum erstellst du noch eine extra Canvas? eine form hat doch schon eine Canvas, auf der du zeichnen kannst.
und zum 3. Millionsten mal, relative Pfadangaben bringen dir nur Probleme.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
en!gma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: So 31.07.05 20:09 
ich habe ja keine form.
also die wird versteckt.

und ich hab ja schon ExtractFilePath (Application.ExeName)+'meinBild.bmp'
im programm :D
en!gma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: So 31.07.05 21:04 
kann mir denn keiner sagen warum das nicht geht? : /
ManuelGS
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 173

Win XP HE, Suse Linux
D6, D7, D2005 Personal
BeitragVerfasst: So 31.07.05 21:08 
wenn du sagst, dass die form versteckt wird, auf wessen canvas malst du dann?

_________________
"Leben ist gänzlich Bühne und Spiel; so lerne denn spielen
und entsage dem Ernst - oder erdulde das Leid." - Palladas von Alexandria
en!gma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: So 31.07.05 21:12 
ich male auf dem desktop.

und wie gesagt

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
bild := TBitmap.Create;
cnv := TCanvas.Create;
bild.LoadFromFile('bild.bmp');
    cnv.Draw(10,10,bild);

end;

so klappt es ja. nur wenn ich das bild am anfang laden will geht es nicht

Moderiert von user profile iconKlabautermann: Code- durch Delphi-Tags ersetzt.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 31.07.05 21:17 
sowie das jetzt dasteht, hast du schnell ein großes Speicherproblem, da das free fehlt. irgendwann wirst du out of Ressources sein.
Ansonsten kann ich dir nichts dazu sagen, da ich mich mit sowas nicht beschäftige. Allerdings glaube ich nicht, das du der Erste bist, der auf dem Desktop zeichnen will. Suche in: Delphi-Forum, Delphi-Library DESKTOP ZEICHNEN wird wohl ein paar Beiträge liefern.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
en!gma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: Mo 01.08.05 00:05 
hab grad gesucht und gesucht und hab herausgefunden, dass
cnv noch nil ist im oncreate! wie kann ich das ändern?

achja und im oncreate lade ich einfach ein bild in image1 und lass das dann jedes mal zeichnen, sollte auch schneller gehen oder?

//edit
hab gelesen, dass man ein bool im form create auf true setzten soll, dann halt im active fenster alles durchführt und dann das bool wieder auf false stellt.

aber 1. wie macht man es ohne form active?
denn ich habe die form versteckt...
und 2. selbst wenn ich die form anzeige ist mein canvas und mein ini immernoch auf nil.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 01.08.05 00:57 
user profile iconen!gma hat folgendes geschrieben:
ich male auf dem desktop.

Und wo malst du auf den Canvas des Desktops? Ich sehe niergens, dass du dir den DC des Desktops ermittelst.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mo 01.08.05 04:05 
so sollte es gehen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
var dc: hdc;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
   cnv.Draw(10,10,bild);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  bild := TBitmap.Create;
  cnv := TCanvas.Create;
  dc := getDc(0);
  cnv.handle := dc;
  bild.LoadFromFile('bild.bmp');
end;

procedure formDestroy...
begin
   ReleaseDc(0,DC);
   cnv.free; bild.free;
end;

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...