Как преобразовать bmp (32×32) в ico
Как преобразовать bmp (32×32) в ico
Как преобразовать bmp (32x32) в ico unit main; interface uses windows, messages, sysutils, classes, graphics, controls, forms,dialogs,extctrls, stdctrls; type tform1 = class(tform) button1: tbutton; image1: timage; image2: timage; procedure button1click(sender: tobject); procedure formcreate(sender: tobject); private { private declarations } public { public declarations } end; var form1: tform1; implementation {$r *.dfm} procedure tform1.button1click(sender: tobject); var windc, srcdc, destdc : hdc; oldbitmap : hbitmap; iinfo : ticoninfo; begin geticoninfo(image1.picture.icon.handle, iinfo); windc := getdc(handle); srcdc := createcompatibledc(windc); destdc := createcompatibledc(windc); oldbitmap := selectobject(destdc, iinfo.hbmcolor); oldbitmap := selectobject(srcdc, iinfo.hbmmask); bitblt(destdc, 0, 0, image1.picture.icon.width, image1.picture.icon.height, srcdc, 0, 0, srcpaint); image2.picture.bitmap.handle := selectobject(destdc, oldbitmap); deletedc(destdc); deletedc(srcdc); deletedc(windc); image2.picture.bitmap.savetofile(extractfilepath(application.exename) + 'myfile.bmp'); end; procedure tform1.formcreate(sender: tobject); begin image1.picture.icon.loadfromfile('c:\myicon.ico'); end; end.