Autor Beitrag
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: So 20.06.04 15:26 
Hallo,
ich habe ein nonVCL Form erstellt und darauf mit DrawIcon ein Icon gezeichnet. Dieses Bild soll automatisch neugezeichnet werden, wenn es nicht mehr sichtbar ist. Hier mein Code aus meiner WndProc Case-Schleife:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
 FUNCTION WndProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; STDCALL;
 BEGIN
   Result := 0;
   CASE uMsg OF
     WM_CTLCOLORSTATIC: SetBkMode(wParam,TRANSPARENT);
     WM_NCPAINT: begin
      Result:=DefWindowProc(hWnd, uMsg, wParam, lParam);
      if wParam=0 then DrawIcon(GetDC(hWnd),8,8,AIcon)
       else DrawIcon(wParam,8,8,AIcon);
     end;
   ELSE
     Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
   END;
 END;
Die Variable AIcon ist global Definiert. Leider wird das Icon nicht gezeichnet. Hat jemand eine Lösung?

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
MathiasSimmack
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 21.06.04 16:08 
Warum verschwindet das Bild eigentlich? (Okay, ich geb´s zu: Ich habe mich damit noch nicht beschäftigt ...) Ich habe einmal ein Static-Control benutzt, ein Symbol geladen und das angezeigt. Das bleibt dann auch sichtbar, selbst wenn ich andere Fenster davor setze ... usw. usw. Da kümmert sich doch eigentlich Windows selbst drum.
maxk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mo 21.06.04 21:58 
Naja, wenn ich es direkt als Resource einbinde, dann verschwindet es auch nicht. Aber das Bild ist jedesmal anders. Und dann ist es wie beim Zeichnen auf ein Canvas.

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
maxk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mo 28.06.04 19:17 
Hier die Lösung:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
 var PS:TPaintStruct;
 begin
  case uMsg of
     WM_PAINT: begin
      BeginPaint(hwnd, PS);
      Result:=DefWindowProc(hWnd, uMsg, wParam, lParam);
      if wParam=0 then DrawIcon(GetDC(hWnd),8,8,AIcon)
       else DrawIcon(wParam,8,8,AIcon);
      EndPaint(hwnd, PS);
     end;

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.