Skip to content

Argimko/Class_ImageButton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Class_ImageButton

Image Buttons for AHK GUIs.

Features

The class creates an image list and assigns it to the pushbutton control. Button image lists may contain one or six images. If they contain only one image, the image will be used to draw all button states (i.e. the button won't be animated). Otherwise the images will be used to draw the appropriate six button states:

PBS_NORMAL    = 1
PBS_HOT       = 2
PBS_PRESSED   = 3
PBS_DISABLED  = 4
PBS_DEFAULTED = 5
PBS_STYLUSHOT = 6 ; used only on tablet computers

How to use

  1. Create a push button (e.g. Gui, Add, Button, vMyButton HwndHBTN, Caption) using the Hwnd option to get its HWND.

  2. Call ImageButton.Create() passing two parameters:

     HWND        -  Button's HWND.  
     Options*    -  variadic array containing up to 6 option arrays (see below).
    

    The index of each option object determines the corresponding button state on which the bitmap will be shown (see above).

    If you don't want the button to be 'animated' on themed GUIs, just pass one option object with index 1.

    Each option array may contain the following values:

     Index Value
     1     Mode        mandatory:
     				  0  -  unicolored or bitmap
     				  1  -  vertical bicolored
     				  2  -  horizontal bicolored
     				  3  -  vertical gradient
     				  4  -  horizontal gradient
     				  5  -  vertical gradient using StartColor at both borders and
     						TargetColor at the center
     				  6  -  horizontal gradient using StartColor at both borders and 
     						TargetColor at the center
     				  7  -  'raised' style (just try out!)
     2     StartColor  mandatory for Option[1], higher indices will inherit the value of
     				  Option[1], if omitted:
     				  -  RGB integer value (0xRRGGBB) or HTML color name ("Red").
     				  -  Path of an image file or HBITMAP handle for Mode 0
     3     TargetColor mandatory for Option[1] if Mode > 0, ignored if Mode = 0. Higher
     				  indcices will inherit the color of Option[1], if omitted:
     				  -  RGB integer value (0xRRGGBB) or HTML color name ("Red").
     4     TextColor   optional, if omitted, the default text color will be used for Option[1],
     				  higher indices will inherit the color of Option[1]:
     				  -  RGB integer value (0xRRGGBB) or HTML color name ("Red").
     					 Default: 0x000000 (black)
     5     Rounded     optional:
     				  -  Radius of the rounded corners in pixel
     					 Default: 0 - not rounded
     6     GuiColor    optional, needed for rounded buttons if you've changed the GUI background color:
     				  -  RGB integer value (0xRRGGBB) or HTML color name ("Red").
     					 Default: AHK default GUI background color
    

    If the the button has a caption it will be drawn above the bitmap.

  3. That's all!

About

Image Buttons for AHK GUIs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • AutoHotkey 100.0%