Windows Small System Icon Height Incorrect -


i'm running on windows 10, using delphi 7 (yes, know it's quite old).

i want use system icons in windows , have gone defining timagelist called systemicons initialize follows:

var   fileinfo: tshfileinfo;  begin   systemicons.handle := shgetfileinfo('', 0, fileinfo, sizeof(fileinfo),     shgfi_icon or shgfi_smallicon or shgfi_sysiconindex);  ... 

i have systemicons properties set statically timagelist component width , height set 16.

elsewhere, wish retrieve icon image list given valid shell object's image index. because these "small system icons", expect them 16x16. result of calling getsystemmetrics(sm_cysmicon) yields 16. oddly, dimensions depend upon whether retrieve them bitmap or icon.

... var   icon: ticon;   bm: tbitmap;  begin   ...   icon := ticon.create;   systemicons.geticon(imgindex, icon);    bm := tbitmap.create;   systemicons.getbitmap(imgindex, bm); 

the imgindex correct , same in both cases. image retrieved same in each case, expected. dimensions of bitmap (bm.width , bm.height) expected: 16x16. however, dimensions of icon (icon.width , icon.height) not. 32x32.

when paint icon on canvas appears 16x16. it's height , width values appear incorrect. odd.

why these different?

the images 32x32 begin with.

internally, timagelist.geticon() retrieves hicon chosen image directly underlying win32 imagelist api, using imagelist_geticon(), , assigns ticon.handle property.

timagelist.getbitmap(), on other hand, bit different. sizes tbitmap dimensions of timagelist (16x16), , stretch draws chosen image onto tbitmap.canvas using timagelist.draw(), in turn uses imagelist_drawex().


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -