APS NZ
asked on
Showing only one image in a TSpeedButton
Hi
When I load a glyph into a TSpeedButton at runtime, and it contains more than one image, it wants to display them all at the same time. How do I get the button to display only the first image?
John
When I load a glyph into a TSpeedButton at runtime, and it contains more than one image, it wants to display them all at the same time. How do I get the button to display only the first image?
John
adjust the numglyphs property to the count of images of your bitmap
set NumGlyphs to 4, I guess
Perhaps with this code?
These lines of code load a four-image bitmap into the Glyph property of a speed button, and specify the appropriate value for the NumGlyphs property:
SpeedButton1.Glyph.LoadFro mFile('MYB ITMAP.BMP' );
SpeedButton1.NumGlyphs := 4;
These lines of code load a four-image bitmap into the Glyph property of a speed button, and specify the appropriate value for the NumGlyphs property:
SpeedButton1.Glyph.LoadFro
SpeedButton1.NumGlyphs := 4;
ASKER
Thanks for the replies.
I have tried using the NumGlyphs property, but I still find that the speedbutton tries to load all the images at once. This is my code:
GlyphBtn[UpTo].NumGlyphs := 1;
GlyphBtn[UpTo].Glyph.LoadF romFile(Di rInfo.Name );
(I am using FindFirst etc to locate the bitmaps). I also tried setting NumGlyphs after loading the image, but I still get the same result. Any ideas?
John
I have tried using the NumGlyphs property, but I still find that the speedbutton tries to load all the images at once. This is my code:
GlyphBtn[UpTo].NumGlyphs := 1;
GlyphBtn[UpTo].Glyph.LoadF
(I am using FindFirst etc to locate the bitmaps). I also tried setting NumGlyphs after loading the image, but I still get the same result. Any ideas?
John
to repeat
>adjust the numglyphs property to the count of images of your bitmap
contains your bitmap 4 pictures then set NumGlyphs to 4 -> one image is shown on the speedbutton
contains your bitmap 2 pictures then set NumGlyphs to 2 -> one image is shown on the speedbutton
meikl ;-)
>adjust the numglyphs property to the count of images of your bitmap
contains your bitmap 4 pictures then set NumGlyphs to 4 -> one image is shown on the speedbutton
contains your bitmap 2 pictures then set NumGlyphs to 2 -> one image is shown on the speedbutton
meikl ;-)
ASKER
Thanks Meikl
How do I know how many images there are in the bitmap?
John
How do I know how many images there are in the bitmap?
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello Fraction
I never realised it would be so complicated! You gave me the right idea. I divided the width by 24 (an average size) and used the integer result as the answer. It seem to work OK. I am surprised there is not a property called ImageCount or something.
John
I never realised it would be so complicated! You gave me the right idea. I divided the width by 24 (an average size) and used the integer result as the answer. It seem to work OK. I am surprised there is not a property called ImageCount or something.
John
i guessed you more clever, my mistake