Jump to content

Recommended Posts

Posted

Hello everyone, I have been looking around the forums for help on this, and I havent actually found anything that helps.

What I want to do, is insert an image for use as a button. I have looked at a certain command I found in the help forums ($BS_BITMAP), but that doesnt seem to generate a button aswell as an image. Am I meant to put this right after the button's script, or am I meant to do something else? Also, if there is any other command that does this, can somebody please tell me about it?

Thanks.

Posted

Hey Mike!

I think it should be noted that he does not want it put on a button, rather just the image he can click that acts like a button.

shanet out

[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:

%programfiles%/AutoIt3/autoit3.chm
  • Moderators
Posted

Mikeman27294,

Welcome to the AutoIt forum. :x

I am unsure if you want a button with an image on it or an image which can be clicked like a button - so here is how to do both: ;D

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

$hGUI = GUICreate("Test", 400, 500)

$hPic = GUICtrlCreatePic("Your_Image_Path", 10, 10, 380, 380)

$hButton = GUICtrlCreateButton("", 10, 400, 80, 80, $BS_BITMAP)
GUICtrlSetImage($hButton, "Your_Image_Path")

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hPic
            MsgBox(0, "Hi!", "You clicked the picture")
        Case $hButton
            MsgBox(0, "Hi!", "You clicked the button")
    EndSwitch

WEnd

Please ask if you have any questions on the code. :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

Welcome to the AutoIt forum.

Thanks, I am glad to be here :x

I am unsure if you want a button with an image on it or an image which can be clicked like a button - so here is how to do both

Yes, I wanted an image that can be clicked as a button. That is exactly what I wanted, thankyou.

I now understand how I am meant to do what I am trying to do.

Thanks again.

Posted

Does it work?

[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:

%programfiles%/AutoIt3/autoit3.chm

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...