Вниз
Скачать: CL | DM;

Иконки в ХР   Найти похожие ветки 

← →
Tik   (2003-11-06 17:35) [0]

Вот код: ((- в 98-ом --- все ОК! Но в ХР иконок нету.))
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl, ComCtrls,ShellAPI;

type
TForm1 = class(TForm)
ListView1: TListView;
DirectoryListBox1: TDirectoryListBox;
ComboBox1: TComboBox;
DriveComboBox1: TDriveComboBox;
procedure FormCreate(Sender: TObject);
procedure DirectoryListBox1Change(Sender: TObject);
procedure ComboBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure UpdateFiles;
var
sr: TSearchRec;
li: TListItem;
fi: TSHFileInfo;
ext: string;
IconIndex: word;
ic: TIcon;
begin
Form1.ListView1.Items.BeginUpdate;
Form1.ListView1.Items.Clear;
if FindFirst(Form1.DirectoryListBox1.Directory + "\*.*", faAnyFile, sr) = 0 then repeat
if sr.Attr and faDirectory <> 0 then continue;
li := Form1.ListView1.Items.Add;
li.Caption := sr.Name;
ext := LowerCase(ExtractFileExt(li.Caption));
ShGetFileInfo(PChar("*" + ext), 0, fi, SizeOf(fi),
SHGFI_SMALLICON or SHGFI_SYSICONINDEX or SHGFI_TYPENAME);
li.ImageIndex := fi.iIcon;
if sr.Size < 1024
then li.SubItems.Add(IntToStr(sr.Size) + " byte")
else if sr.Size < 1024 * 1024
then li.SubItems.Add(IntToStr(round(sr.Size / 1024)) + " KByte")
else li.SubItems.Add(IntToStr(round(sr.Size / (1024 * 1024))) + " MByte");
li.SubItems.Add(fi.szTypeName);
until FindNext(sr) <> 0;
FindClose(sr);
Form1.ListView1.Items.EndUpdate;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
fi: TSHFileInfo;
lc: TListColumn;
begin
DriveComboBox1.DirList := DirectoryListBox1;
with ListView1 do begin
SmallImages := TImageList.CreateSize(16,16);
SmallImages.Handle := ShGetFileInfo("*.*", 0, fi,
SizeOf(fi), SHGFI_SMALLICON or SHGFI_ICON
or SHGFI_SYSICONINDEX);
LargeImages := TImageList.Create(nil);
LargeImages.Handle := ShGetFileInfo("*.*", 0, fi,
SizeOf(fi), SHGFI_LARGEICON or SHGFI_ICON
or SHGFI_SYSICONINDEX);
lc := Columns.Add;
lc.Caption := "Name";
lc := Columns.Add;
lc.Caption := "Size";
ComboBox1.Items.Add("Icons");
ComboBox1.Items.Add("List");
ComboBox1.Items.Add("Table");
ComboBox1.Items.Add("SmallIcons");
ComboBox1.ItemIndex := 0;
end;
UpdateFiles;
end;

procedure TForm1.DirectoryListBox1Change(Sender: TObject);
begin
UpdateFiles;
end;

procedure TForm1.ComboBox1Click(Sender: TObject);
begin
case ComboBox1.ItemIndex of
0: ListView1.ViewStyle := vsIcon;
1: ListView1.ViewStyle := vsList;
2: ListView1.ViewStyle := vsReport;
else ListView1.ViewStyle := vsSmallIcon;
end;
end;

Вчем проблема???


← →
Woodpecker   (2003-11-06 18:55) [1]

В ДНК.



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.015 c
4-63458
goliath
2003-11-16 16:31
2004.01.20
WM_COPYDATA


11-63052
Babenko Alexey
2003-04-16 14:30
2004.01.20
MCK 1.7 глюки


3-63019
Trad
2003-12-22 06:47
2004.01.20
прямая запись в БД


1-63080
NailMan
2004-01-08 16:27
2004.01.20
Какие-то глюки с округлением чисел


1-63063
serg128
2004-01-08 12:45
2004.01.20
Как сохранить проигрываемый звук в MP3?




   Наверх