IMAGES ON BUTTONS AND STATICTEXT
by Mike Bradbury mike@karemi.fsnet.co.uk

Home

Liberty BASIC News
Safe Registry and Ini File Alternative
Deleting and Renaming Disk Files
Segments and Flushing
Flat Toolbar with Toolips
Translating 32-bit VB API Calls
Event-Driven Programming Concepts
Spotlight on the Community!
ODBC in Liberty BASIC
Hex Viewer
Listing Files Recursively
Registering Hot Keys
Preventing more than 1 instance
Multi-Coloured Text Input Boxes
Images on Buttons and Statictext
Two Demos by David Conner

Images and Icons on buttons, Images in statictext controls and justifying text in static controls.
~~~~~~~~~~~~~~~~~

I would agree with Alyce's recommendation that anyone still using LB2 would find much benefit from an upgrade to LB3, unless of course you need to run your programs in Windows 3.x

The demos for this short submission are included with the newsletter in MBradbury.zip and only tested in ****LB3.02**** and Win98SE.

The zip file also includes some small images and an icon, just unzip everying into a temporary folder and run the .lba files.

Program BMPonButton3.lba puts an image symbol2.bmp on to a standard LB button. The image can be placed to the left, centre or right of the button and is the same size as a small icon (16x16 pixel) so you can construct a collection of images and use them like icons or to add a profile to a button.

Program ICONonButton.lba allows you to choose an icon (.ico) file or to extract an icon from a .exe or .dll file. The icon can be placed to the left, centre or right of the button. An icon file cat.ico is included and is a large icon, 32x32 pixels. After trying this icon, select a dll or exe from another directory. Each click of button allows you to choose a new icon.

Program StaticControlJustify.lba allows text in a statictext control to be justified left, centre or right. Remember that a statictext control autowraps.

Program StaticControlImage.lba replaces text in a statictext control with a bmp image. The control will resize itself to fit the image. As the control will revert to its defined size if the window is resized, it is advisable to make the control the same size as the image. If you need to know the image size, load it into MS Paint where Image menu/Attributes will give you the size in pixels. The bmp eiffel.bmp is included but try your own bitmaps as well. Now you can have graphic images in a window type 'window'

All the controls in these demos are standard Liberty BASIC controls drawn with LB commands and thus respond to LB commands so the only calls to the Windows API are to change the control styles.

MBradbury.zip contents:

BMPonButton3.lba
ICONonButton.lba
StaticControlJustify.lba
StaticControlImage.lba
symbol1.bmp
symbol2.bmp
cat.ico
eiffel.bmp

I hope you find these demos useful.....I can't imagine what programming you are doing if not :>)

Mike Bradbury (mike@karemi.fsnet.co.uk)

Home

Liberty BASIC News
Safe Registry and Ini File Alternative
Deleting and Renaming Disk Files
Segments and Flushing
Flat Toolbar with Toolips
Translating 32-bit VB API Calls
Event-Driven Programming Concepts
Spotlight on the Community!
ODBC in Liberty BASIC
Hex Viewer
Listing Files Recursively
Registering Hot Keys
Preventing more than 1 instance
Multi-Coloured Text Input Boxes
Images on Buttons and Statictext
Two Demos by David Conner