Autor Beitrag
supersass1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Mi 19.09.07 13:42 
Hallo,

und zwar möchte ich, ein "Bild" auf dem ganzen Desktop erzeugen.
Die Funktion dazu habe ich quasi schon, ich brauche nun eine Anleitung/Tutorial/Ideen zum "Zeichnen". Ich habe mir sagen lassen, dass dies mit der Funktion Canvas möglich ist.

Doch wie funktioniert das genau, als Beispiel, möchte ich 2 riesen Buchstaben auf roten Hintergrund zeichnen.

Ich stell mit das so vor, dass ich quasi Koordinanten angebe, die mit Farbe gefüllt werden, doch wie funktioniert dies?!


Viele liebe Grüße
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 19.09.07 13:45 
Zunächst mal :welcome: hier im Forum! :D

Was die Funktionsweise des Canvas-Objekts angeht, sollte dir diese Seite weiterhelfen:
www.cfg-hockenheim.d...i/grafik/grafik.html
supersass1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Mi 19.09.07 13:51 
user profile iconjaenicke hat folgendes geschrieben:
Zunächst mal :welcome: hier im Forum! :D


Ja viele Dank ;)

Zitat:

Was die Funktionsweise des Canvas-Objekts angeht, sollte dir diese Seite weiterhelfen:
www.cfg-hockenheim.d...i/grafik/grafik.html


DAs sieht mir ein wenig so aus, als ob sich das sehr auf das Delphi Fesnter beschränkt, ist damit auch Möglich, auf dem Desktop zu zeichnen, nicht dass ich was "sinnloses" lerne...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 19.09.07 14:00 
Das geht schon:
www.delphipraxis.net...schirm+zeichnen.html
Natürlich kannst du auch direkt mit API-Funktionen auf den DC zeichnen, da gibts dann z.B. DrawText.
supersass1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Mi 19.09.07 14:16 
ah okay. Klingt interessant. Ich geb mein bestens.

Ich dachte vielleicht noch an eine Seite, die diese ganze Draw-Funktionen auflistet. Ich könnt mir vorstellen, dass es auch Extra-Effekte gibt, kp Farben überblenden nach 2 Sekunden oder so, sodass Läufe entstehen oder so.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 19.09.07 14:48 
user profile iconsupersass1 hat folgendes geschrieben:
Ich könnt mir vorstellen, dass es auch Extra-Effekte gibt, kp Farben überblenden nach 2 Sekunden oder so, sodass Läufe entstehen oder so.
Nö, sowas gibts nicht, das musst du alles selbst programmieren... ;-)
supersass1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Mi 19.09.07 14:54 
Ich hab noch nich so ganz den Überblick,
ich kann einzelne Pixel färben, das weiß ich, aber was kann ich noch wie machen?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 19.09.07 15:18 
:shock:
Die Funktionen sind doch alle unter dem ersten von mir geposteten Link beschrieben, also Linien, Rechtecke, etc., wo liegt da das Problem? Die Beschreibung des Links "Zeichenfunktionen" auf dieser Seite ist nicht eindeutig genug? :gruebel:
Zitat:
Zu den Methoden des Canvas-Objekts gehört das Zeichnen von Punkten, Linien, Rechtecken, Ellipsen, Sektoren, Kreisbögen, Streckenzügen und Vielecken.


// EDIT:
Ach, ich seh schon, Draw-Funktionen? Du meinst also die API direkt? Moment... Sorry
Ja, bei Microsoft findet sich da einiges, eine Liste der befehle direkt wüsste ich jetzt nicht.
msdn2.microsoft.com/...ibrary/ms533909.aspx gibts zum Beispiel noch.
Aber die Syntaxergänzung mit Strg + Leertaste nachdem du in Delphi Draw geschrieben hats, sollte doch helfen, oder?
supersass1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Mi 19.09.07 15:23 
Doch ich denke schon, ich bin nur immer in solchen SAchen "schüchtern".

Mir würde ien Beispiel Code immer ganz gut tun, aber das klappt schon.

Mittlerweile ist mein ganzer Bildschirm grün, weil ich mit 2 for schleifen jeden Pixel grün färben lasse ;)
supersass1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Mi 19.09.07 16:58 
Tut mir leid wegen des Doppelposts.

So nun kann ich alles mögliche schon darstellen, aber nichts was sich "bewegt".
Wie kann ich eine bewegende Darstellung machen? Ganz grob dargestellt meinetwegen auf nem roten untergrund, ein kleines Viereck was von links nach rechts wandert.

Wie ist des möglich?

ich stell mir vor, dass man mittels Sleep quasi ein Bild darstellt, eine milisekunde später alles neu generiert und das viereck ein pixel weiter links...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 19.09.07 18:50 
Mit Sleep geht das gar nicht, wenn überhaupt so, dann mit ner eigenen Schleife, weil während Sleep deine Anwendung nix tut und aussieht als wäre sie abgestürzt. Besser wäre ein Timer, der (evtl. abhängig von der Zeit um zu langsames Bewegen bei höherer Prozessorauslastung zu verhindern) das jeweils aktuelle Bild berechnet und darstellt.
supersass1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Mi 19.09.07 20:48 
Timer.. Timmer.

ICh bin neu in Delphi, an was fürne Art von Timer denkst du. Hast du ein Beispiel?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 19.09.07 23:06 
Ein Timer löst in einem bestimmten Zeitabstand ein Event aus, in dem du dann deine Zeichenoperation durchführen kannst. Was gerade wo gezeichnet werden muss, kannst du dir in Formularvariablen oder globalen Variablen merken.

In der Komponentenpalette hast du TTimer, das packst du aufs Formular, stellst bei Intervall in Millisekunden ein, wieviel zeit zwischen den Events liegen soll und klickst doppelt auf die Komponente drauf. Dann landest du im Quelltextfenster und kannst dort hinschreiben, was bei jedem Event passieren soll.
Aktivieren per Quelltext geht dann mit Timer1.Enabled := true;, deaktivieren der Events mit Timer1.Enabled := false;.
supersass1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Do 20.09.07 10:00 
Ah vielen lieben Dank, war echt eine klasse Hilfe.

Klappt super, danke =)