Autor Beitrag
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Sa 31.12.05 15:43 
Hallo,

Ich möchtest einfach nur die (Tray)Icons, die in der Prozedure erstellt werden, nebeneinander auf eine Form bringen, als TImage oder sonstiges. Ich möchte also keine Listbox mehr benutzen müssen.
Wie mache ich das? :roll:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
for x := 1 to LV.items.count-1 do
begin
task[1]:= TImage.Create(nil);
with task[1] do
        begin
             Parent := frmMain;
             Height := 27;
             Width := 100;
             Top := 12;
             Picture.Icon := TIcon.Create;
             Stretch := true;
             if x <> 0
             then Left := Width * x + (x-2)*Height
             else Left := Parent.Width - Width * 3 div 2;
             Show;
             Repaint
        end;
end;



Der gesamte Code:
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:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
procedure TfrmMain.FillLV();
var
  ticons: arrTray; //icones du tray
  LI: TListItem;
  x: Cardinal;
  hTray: Cardinal; //hwnd du tray
  stdico: TIcon;
  sys: Systray; //icones du Tray
begin

//on demande la hwnd du tray
  hTray := GethWndTray();

//on prépare l//imagelist
//vide
  IL.Clear;
//16x16
  IL.Height := 16;
  IL.Width := 16;
  LV.SmallImages := IL;

//on efface le contenu du listview
  LV.Items.Clear;

//si NT/2000/XP
  if IsWindowsNT = True then
  begin
    InitPSAPI;
    ticons := GetTrayIcons;
    //pour chaque icone
    for x := 0 to High(ticons) do
    begin
      stdico := TIcon.Create;
      stdico.Handle := ticons[x].hIcon;
        //on ajoute l//image à l//ImageList
      if IL.AddIcon(stdico) = -1 then
      begin
        stdico.Handle := GetTrayIcon_NT(hTray, ticons[x].iBitmap);
        IL.AddIcon(stdico);
        DestroyIcon(stdico.Handle);
      end;
        //on efface l//image
      stdico.ReleaseHandle;
      stdico.Free;

        //on ajoute les infos
      LI := LV.Items.Add;
      LI.ImageIndex := x;
      LI.Caption := ticons[x].uniPath;

      LI.SubItems.Add(ticons[x].sTip);
      LI.SubItems.Add(IntToStr(ticons[x].hwnd));
      LI.SubItems.Add(IntToStr(ticons[x].uID));
      LI.SubItems.Add(IntToStr(ticons[x].idCommand));
      LI.SubItems.Add(GetState(ticons[x].fsState));
      LI.SubItems.Add('Bouton');
      LI.SubItems.Add(IntToStr(ticons[x].iBitmap));
      LI.SubItems.Add('$' + IntToHex(ticons[x].uCallbackMessage, 8));
    end;
    UninitPSAPI;
  end
  else
  begin
    //on demande les icones
    sys := GetTrayIcons_9x();

    //pour chaque icone
    for x := 0 to sys.lpsysListHeader.dwCount - 1 do
    begin
      stdico := TIcon.Create;
      stdico.Handle := GetTrayIcon_9x(hTray, sys.hImageList, sys.lpsysListHeader.lpNotifyDataList[x].dwImageIndex);
      IL.AddIcon(stdico);
      DestroyIcon(stdico.Handle);
        //on efface l//image
      stdico.ReleaseHandle;
      stdico.Free;

        //on ajoute les infos
      LI := LV.Items.Add;
      LI.ImageIndex := x;
      LI.Caption := sys.lpsysListHeader.lpNotifyDataList[x].Path;

        //on ajoute les infos
      LI.SubItems.Add(sys.lpsysListHeader.lpNotifyDataList[x].NotifyDataA.szTip);
      LI.SubItems.Add(IntToStr(sys.lpsysListHeader.lpNotifyDataList[x].NotifyDataA.hwnd));
      LI.SubItems.Add(IntToStr(sys.lpsysListHeader.lpNotifyDataList[x].NotifyDataA.uID));
      LI.SubItems.Add(IntToStr(sys.lpsysListHeader.lpNotifyDataList[x].NotifyDataA.uID));
      LI.SubItems.Add('No');
      LI.SubItems.Add('Bouton');
      LI.SubItems.Add(IntToStr(sys.lpsysListHeader.lpNotifyDataList[x].dwImageIndex));
      LI.SubItems.Add('$' + IntToHex(sys.lpsysListHeader.lpNotifyDataList[x].NotifyDataA.uCallbackMessage, 8));
    end;
  end;

for x := 1 to LV.items.count-1 do
begin
task[1]:= TImage.Create(nil);
with task[1] do
        begin
             Parent := frmMain;
             Height := 27;
             Width := 100;
             Top := 12;
             Picture.Icon := TIcon.Create;
             Stretch := true;
             if x <> 0
             then Left := Width * x + (x-2)*Height
             else Left := Parent.Width - Width * 3 div 2;
             Show;
             Repaint
        end;
end;

// ne pas oublier
  UninstallHook;
end;
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Sa 31.12.05 16:20 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
for x := 1 to LV.items.count-1 do
begin
task[x]:= TImage.Create(nil);
with task[x] do
        begin
             Parent := frmMain;
             Height := 27;
             Width := 100;
             Top := 12;
             Picture.Icon := TIcon.Create;
             Stretch := true;
             if x <> 0
             then Left := Width * x + (x-2)*Height
             else Left := Parent.Width - Width * 3 div 2;
             Show;
             Repaint
        end;
end;

so muss das glaube ich schonmal sein
Marc. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Sa 31.12.05 18:42 
n....funzt auch nich...also ich kanns compilieren nur wird nix angezeigt