Autor Beitrag
Philipp_Reitter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 430



BeitragVerfasst: So 07.10.07 15:32 
hi

ich lass sachen auf die desktopcanvas zeichen aber dann will ichs wieder alles weglöschen....
wie geht das ?

mfg
Philipp
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: So 07.10.07 15:44 
Merk dir, wies am Anfang aussieht, und zeichne das ;-)

_________________
We are, we were and will not be.
Philipp_Reitter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 430



BeitragVerfasst: So 07.10.07 15:54 
oh.... gibts da nix so ähmm... Canvas.Clear;
ub60
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 765
Erhaltene Danke: 130



BeitragVerfasst: So 07.10.07 17:30 
ausblenden Delphi-Quelltext
1:
Image1.Picture:=NIL;					

und dann noch irgend einen Dummybefehl auf die Canvas, z.B.
ausblenden Delphi-Quelltext
1:
Image1.Canvas.Pen.Color:=clBlack;					

Hab aber keine Ahnung, ob dabei Speicherlecks entstehen. Müsste man noch prüfen.

ub60
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Mo 08.10.07 03:35 
@ub60
er schreibt vom desktop-canvas nicht das eines TImage.
also das da: :)
ausblenden Delphi-Quelltext
1:
2:
  CV:=TCanvas.create;
  CV.Handle := GetWindowDC( GetDesktopWindow );


ich wage mich zu erinnern, dass man über ein InvalidateRect das Gezeichnete löschen konnte, finde aber gerade mein Test-Projekt nicht mehr ;)
im DFMEdit lasse ich das entsprechende Fenster neu malen (habe vorher auf dem ScreenCanvas über dem Form gemalt)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
const
  FLAGS = RDW_ERASE or RDW_FRAME or RDW_INVALIDATE or RDW_UPDATENOW or RDW_ALLCHILDREN;

RedrawWindow(self.Handle, nil, 0, FLAGS);


mit den flags kannst ja ein wenig rumspielen, da das desktopfenster ja z.b. keine Childcontrols hat...

HTH Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 08.10.07 09:20 
Den Screen löschen und wiederherstellen ist einfach:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowWindow(FindWindow(nil, 'Program Manager'), SW_HIDE);
  ShowWindow(FindWindow(nil, 'Program Manager'), SW_SHOW);
end;
turboPASCAL
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 193
Erhaltene Danke: 1

Win XP / Vischda
D6 PE / D2005 PE
BeitragVerfasst: Di 09.10.07 23:31 
Entschuldige wenn ich es so sage, auf den Deskto(Canvas) herumzumalen ist das dümmste was man machen kann.
Windows greift selbst in bestimmten abständen darauf zu um selbst etwas zu malen.

Ein "...Canvas.Clear" gibt es nicht bei der normalen GDI -VCL einbindung von Delphi.
Zeichne also beispielsweise ein weisses rechteck über den Bereich den du "löschen"
möchtest.
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 10.10.07 08:16 
Es gibt Programme, die kurzzeitig etwas anzeigen auf dem Desktop:

- Infrarot-Empfänger
- DVD-Player
- Temperatur-Anzeigen
- u.v.a.
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 10.10.07 10:10 
Wäre es nicht besser dafür ein Fester zu nehmen, dass du dann AlwaysOnTop setzt ?

_________________
In the beginning was the word.
And the word was content-type: text/plain.
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 10.10.07 13:14 
user profile iconmatze hat folgendes geschrieben:
Wäre es nicht besser dafür ein Fester zu nehmen, dass du dann AlwaysOnTop setzt ?


Nein.
Funktioniert nicht bei Programmen im Fullscreen-Modus.

Für AMD-Freunde habe ich ein DEMO rangehängt.
Einloggen, um Attachments anzusehen!
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 10.10.07 19:37 
Screenshot:
Einloggen, um Attachments anzusehen!
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 10.10.07 22:10 
ist zwar keine feine Methode, aber vielleicht hilft dir dieser Artikel weiter:
www.michael-puff.de/...InvalidateRect.shtml

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: Mi 10.10.07 22:20 
HIHI

ich erinner mich da an ein Scherzprogramm vor zig Jahren...da war die Mausspur ein Radiergummi.

Mal sehen, werde ich vielleicht mal als Aprilscherz in mein Prrogramm einbauen.
Da freu ich mich schon auf die entsetzten Gesichter meiner User :rofl:

Gruß

Aga
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 10.10.07 22:27 
user profile iconmatze hat folgendes geschrieben:
ist zwar keine feine Methode...


Warum?
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Do 11.10.07 00:02 
wie turboPascal schon sagte, sollte man es vermeiden auf dem screen-canvas rumzumalen, da man nicht weis, wie lange das gemalte besteht.
Evtl malt man über ein Fenster drüber und wenn man das verschiebt klebt ein teil des Textes auf dem Fenster.

Ich kenne jedoch auch die Problematik, dass man vor ein Spiel kein Fenster bekommt, weder mit dem FormStyle noch mit SetWindowPos.
Hatte mir damals mal ein Beispiel-Programm geschrieben, um solche OSD's (OnScreenDisplays) dynamisch zu erzeugen (mittels Form+Regions) und da ist mir das auch aufgefallen...
www.fw-web.de/downlo...delphi/units/OSD.zip

Gruß Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 11.10.07 08:27 
OSD gefällt mir.
Ich habe die AMD-Core-Temperatur-Anzeige und einen Timer und HWND_TOPMOST hinzugefügt - funktioniert
super - auch bei Fullscreen-Programmen!

ausblenden volle Höhe 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:
27:
28:
29:
30:
31:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
     MeasureTemp;
     FormDblClick(Self);
end;

procedure TForm1.FormDblClick(Sender: TObject);
begin
    DeleteObject(HRgn);
    Canvas.Font.Name  := 'Comic Sans MS';
    Canvas.Font.Size  := 24;
    Canvas.Font.Style := [fsBold];
    self.width:=Canvas.TextWidth(C0)+20;
    self.height:=Canvas.TextHeight(C0)+50; 

    BeginPath(Canvas.Handle);
    SetBkMode( Canvas.Handle, TRANSPARENT );

    Canvas.TextOut(10, 10, C0);
    if Core2Present then Canvas.TextOut(10, 40, C1) else Canvas.TextOut(10, 40, 'Core0');
    Canvas.Rectangle(Btn_Close.left,Btn_Close.top,Btn_Close.Left+Btn_Close.width,Btn_Close.top+Btn_Close.Height);
    Canvas.Pen.Color:=clBlack;
    canvas.Brush.color:=clred;
    Canvas.Rectangle(0,0,width,height);
    Canvas.Rectangle(3,3,width-3,height-3);

    EndPath(Canvas.Handle);
    HRgn := PathToRegion(Canvas.Handle);
    SetWindowRgn(Handle, HRgn, True);
    SetWindowPos(Handle,HWND_TOPMOST, 0, 0, 0, 0,SWP_NOMOVE + SWP_NOSIZE);
end;


Der gesamte Sourcecode ist im Anhang.
Einloggen, um Attachments anzusehen!
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Do 11.10.07 08:42 
user profile iconhathor hat folgendes geschrieben:
OSD gefällt mir.
Ich habe die AMD-Core-Temperatur-Anzeige und einen Timer und HWND_TOPMOST hinzugefügt - funktioniert
super - auch bei Fullscreen-Programmen!

ausblenden Delphi-Quelltext
1:
2:
    ...
    SetWindowPos(Handle,HWND_TOPMOST, 0, 0, 0, 0,SWP_NOMOVE + SWP_NOSIZE);


keine Ahnung, warum das bei mir damals nicht geklappt hat, afair hatte ich das auch mit Top_Most probiert...

es sei vllt. noch zu erwähnen das Flags normal per OR kombiniert werden. in deinem Fall funktioniert es zwar, aber wenn du vorher flags irgendwo ausliest, wo das flag schon gesetzt ist, funktioniert es nicht mehr.

Gruß Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3