Forum
Grundkurs
»Introduktion
»Snabbguide
»Komponenter
»Händelser
»Strängar
»Räkna med Delphi »Egna
typer
»Selektion
»Iteration
»Menyer
»Funktioner
»Arraystrukturer
Tips & Tricks
»Nya tips
»Blandat
»Databaser
»Filer
»Forms
»Grafik
»Internet
»Komponenter
»Matematik
»Multimedia
»Objekt/ActiveX
»Skrivare
»Strängar
»System
»Mest lästa tips
Artiklar
»Delphi och ADO
»Bygga en DLL
»Skapa en enkel rapport
»Hantera registret
»Enheter, units
»Klassen TCanvas
»Använd LookUp Controls
Nya
tips
Lägg
till tips
Delphilänkar
Gästbok
|
|
|
|
Använd systemikonerna
|
Kategori: Grafik
Inlagt: 2004-12-05
Läst: 1402
Inlagt av: Staffan Berg
|
Beskrivning |
Detta är ett exempel som visar hur du kan använda Windows inbyggda systemikoner. Du hittar en lista längst ned i exemplet över de olika konstanterna som finns tillgängliga.
|
Kod |
var FileInfo: TSHFileInfo; begin //to get a small icons imgListSysSmall := TImageList.Create(nil); with imgListSysSmall do begin Handle := SHGetFileInfo('', 0, FileInfo, SizeOf(TSHFileInfo), SHGFI_SMALLICON or SHGFI_SYSICONINDEX ); ShareImages := True; end; //to get a small icons imgListSysLarge := TImageList.Create(nil); with imgListSysLarge do begin Handle := SHGetFileInfo('', 0, FileInfo, SizeOf(TSHFileInfo), SHGFI_LARGEICON or SHGFI_SYSICONINDEX ); ShareImages := True; end; end; //Also if you want to get a "My Computer" icon, you must use the next function: var FileInfo: TSHFileInfo; PIDL: PItemIDList; begin SHGetSpecialFolderLocation(Application.Handle, CSIDL_DRIVES, PIDL); if SHGetFileInfo(PChar(PIDL), 0, FileInfo, SizeOf(TSHFileInfo), SHGFI_PIDL or SHGFI_SYSICONINDEX ) <> 0 then Result := FileInfo.iIcon; end; //In this function you can use the constants from shlobj.pas: CSIDL_DESKTOP = $0000; CSIDL_PROGRAMS = $0002; CSIDL_CONTROLS = $0003; CSIDL_PRINTERS = $0004; CSIDL_PERSONAL = $0005; CSIDL_FAVORITES = $0006; CSIDL_STARTUP = $0007; CSIDL_RECENT = $0008; CSIDL_SENDTO = $0009; CSIDL_BITBUCKET = $000a; CSIDL_STARTMENU = $000b; CSIDL_DESKTOPDIRECTORY = $0010; CSIDL_DRIVES = $0011; CSIDL_NETWORK = $0012; CSIDL_NETHOOD = $0013; CSIDL_FONTS = $0014; CSIDL_TEMPLATES = $0015; CSIDL_COMMON_STARTMENU = $0016; CSIDL_COMMON_PROGRAMS = $0017; CSIDL_COMMON_STARTUP = $0018; CSIDL_COMMON_DESKTOPDIRECTORY = $0019; CSIDL_APPDATA = $001A; CSIDL_PRINTHOOD = $001B;
|
|
|