Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Система";
Текущий архив: 2004.01.20;
Скачать: [xml.tar.bz2];

Вниз

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

 
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 вся ветка

Форум: "Система";
Текущий архив: 2004.01.20;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.012 c
1-63227
ikivio
2004-01-09 15:33
2004.01.20
StringGrid и Selected.


11-63047
Sapsan
2003-05-05 19:46
2004.01.20
не перекомпилируется SysUtils


1-63157
афвуд
2004-01-06 18:51
2004.01.20
TNotifyEvent


1-63179
ValeX
2004-01-10 16:24
2004.01.20
компилер пропускает строки


11-63046
Интересующийся
2003-02-01 01:06
2004.01.20
А зачем? =)





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский