Color-matched Bmpbuttons


'IMPORTANT IMPORTANT IMPORTANT
'SAVE THIS CODE TO FILE IN THE
'FOLDER THAT CONTAINS YOUR VERSION
'OF LIBERTY BASIC.
'
'Demo to use bmpbuttons that makes them
'match the user's desktop color scheme.
'IMPORTANT - to see this in action, change
'your desktop color scheme to something like
'*maple* or *wheat* or *rainy day*.
'The bmpbutton appears with lightgray background
'in one bmpbutton.  The other bmpbutton uses an
'altered version that changes its appearance
'to default system colors!
'
'Remember to make bitmap backgrounds lightgray
'for this to work properly
'
'Alyce Watson, June 21, 2002

nomainwin
WindowWidth=300:WindowHeight=140
bmp$="bmp\cut.bmp"
msg$="Both buttons use the LB bitmap 'cut.bmp'!!"

bmpbutton #1.b, bmp$,[unchanged],UL,10,10
bmpbutton #1.c, bmp$,[changed],UL,60,10
statictext #1.s,msg$,10,50,250,50
open "Color-matched Bmpbuttons!" for window as #1
    #1 "font ms_sans_serif 12"
    #1 "trapclose [quit]"

    flags=_LR_LOADFROMFILE or _LR_LOADMAP3DCOLORS
    calldll #user32, "LoadImageA",_
    0 as long,_                 'instance handle
    bmp$ as ptr,_               'filename
    _IMAGE_BITMAP as ulong,_    'image type
    0 as long,_                 'width, 0=use image's width
    0 as long,_                 'height, 0=use image's height
    flags as long,_             'load flags... very important
    hImage as ulong             'handle to loaded bmp

    loadbmp "demo", hImage      'get LB bmp handle
    #1.c "bitmap demo"          'one bmpbutton has new background color
    wait

[quit]
    unloadbmp "demo"
    close #1:end

[changed]
    notice "My background color matches the color scheme!"
    wait

[unchanged]
    notice "My background color is unchanged lightgray."
    wait

 


Home

Source Code

Utilities

Internet

Games

Graphics

Media Demos

Snippets

DLL's

API Resources

Freeware

LB 4 Companion

Mastering LB 3

LB Workshop

Game Workshop

Links

Index