delphi - How cand I include a bitmap in my custom component (if is possible)? -


i writing component (a button) needs bitmap displayed on it. don't want make imagelist property , user assigns image. want button have image chosen me.

i tried include bitmap in resource file when try access "resource not found" error message. i've done:

myres.rc

fixed bmp "fixed.bmp" 

i compiled resource file with: brcc32 myres.rc

then included in component unit...

implementation {$r .\resources\myres.res} 

and access with...

mycomponent.glyph.loadfromresourcename(hinstance,'fixed'); // mycomponent = class(tspeedbutton) 

edit1: deleted {$r .\resources\myres.res} directive , loaded resource menu project -> resources , it's working, both hinstance or findclasshinstance(mycomponent).

using resource editor found when load resource menu resource appears name "fixed" should, when load resource compiled brcc32 appears name "0". seems brcc32 doesn't set name correctly.

but don't want load menu, want loaded automatically component.

edit2: remy lebeau correct. using wrong bmp format (the file starts 'bm6' characters instead 'bm8' photoshop produce it, , works).

change bmp bitmap in rc file, , change hinstance findclasshinstance() in code:

fixed bitmap "fixed.bmp" 

glyph.loadfromresourcename(findclasshinstance(mycomponent), 'fixed'); 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -