5 réponses
You can use the TSpeedButton or the TBitBtn
(check the Delphi help).
Both allow you to set the image or icon of your
choice, with or without text.
(check the Delphi help).
Both allow you to set the image or icon of your
choice, with or without text.
Thank you for your help.
However, I agree that I might be a bit heavy-handed; I don't see the possibility of adding .BMP files, whereas I would like to include .ICO files.
Could you please specify how to add .ICO files?
Thank you.
However, I agree that I might be a bit heavy-handed; I don't see the possibility of adding .BMP files, whereas I would like to include .ICO files.
Could you please specify how to add .ICO files?
Thank you.
You can convert your BMP files to ICO using different software.
For example, XNView (which can read over 300 different image formats... an excellent French program that I recommend), or simpler: display the icon on the screen, press the 'Print Screen' key, save the clipboard as BMP...
XNView: http://www.xnview.com/
(oh look! They bought a domain name, that's good).
For example, XNView (which can read over 300 different image formats... an excellent French program that I recommend), or simpler: display the icon on the screen, press the 'Print Screen' key, save the clipboard as BMP...
XNView: http://www.xnview.com/
(oh look! They bought a domain name, that's good).
Technically, the same image will take up practically the same space in ICO and BMP (since both formats are uncompressed anyway).
You can safely use the BMP format.
However, once your EXE is finished, you can compress it (for example with the excellent UPX: http://upx.tsx.org).
You can safely use the BMP format.
However, once your EXE is finished, you can compress it (for example with the excellent UPX: http://upx.tsx.org).
Hi JMD
If you absolutely want to use icons, you can use the
ToolBar in the Win32 palette associated with an ImageList as long as you're using Delphi 4 (I don't know if it works with previous versions)
ToolBars are heavier to handle than simple buttons because, as their name indicates, they are designed to manage toolbars. But it works even with just one button.
So first, place a TImageList object on your form.
Note that all your icons must be the same size!
Before loading any icons into the list, first modify the Height and Width properties to match the dimensions of your icons.
Then double-click your image list and load your icons into it
Now place a ToolBar object on your form.
Then link its Image property to your image list ImageList1 for example.
Then right-click the ToolBar [New button]
The first button automatically inherits the first icon that you stored in your image list, the second button the second, and so on. Naturally, you can change the displayed image for the button by changing its ImageIndex property: set it to -1 if you don't want an image.
You can even define a second image list with icons representing the same disabled buttons and associate this list with the DisabledImages property of the ToolBar. So when the Enabled property of one of the buttons changes, the image it displays also changes!
Same with the HotImages property of the ToolBar, but this time the button's image changes when the mouse hovers over the button!
And there you go
@+
Philippe
If you absolutely want to use icons, you can use the
ToolBar in the Win32 palette associated with an ImageList as long as you're using Delphi 4 (I don't know if it works with previous versions)
ToolBars are heavier to handle than simple buttons because, as their name indicates, they are designed to manage toolbars. But it works even with just one button.
So first, place a TImageList object on your form.
Note that all your icons must be the same size!
Before loading any icons into the list, first modify the Height and Width properties to match the dimensions of your icons.
Then double-click your image list and load your icons into it
Now place a ToolBar object on your form.
Then link its Image property to your image list ImageList1 for example.
Then right-click the ToolBar [New button]
The first button automatically inherits the first icon that you stored in your image list, the second button the second, and so on. Naturally, you can change the displayed image for the button by changing its ImageIndex property: set it to -1 if you don't want an image.
You can even define a second image list with icons representing the same disabled buttons and associate this list with the DisabledImages property of the ToolBar. So when the Enabled property of one of the buttons changes, the image it displays also changes!
Same with the HotImages property of the ToolBar, but this time the button's image changes when the mouse hovers over the button!
And there you go
@+
Philippe