1

Тема: AHK: Замена обычной кнопки на custom (img) кнопку

Здравствуйте, с ahk не так давно начали работать. И возник небольшой вопрос.
Имеется такой скрипт.

UrlDownloadToFile, Ссылка на фон, % f := A_Temp "\temp_pic"
Gui, Color, c161643
Gui, Add, Picture, x0 y0 h350 w450, % f
Gui, Add, Button, Default xp+20 yp+250, Название кнопки
Gui, Add, Progress, ce0760b vMyProgress w416 Background161643
Gui, Add, Text, cd0cdd8 vMyText wp
Gui, Show, w450 h350, Тут название окна
return

ButtonStartNorecoil:
Loop, %A_WinDir%\*.*
{
    if A_Index = 100
        break
    GuiControl,, MyProgress, +5
    GuiControl,, MyText, %A_LoopFileName%
    Sleep 50
}
GuiControl,, MyText, Тут текст после нажатия.
return

GuiClose:
Gui, Cancel

Задача следующая, заменить стандартную кнопку заменить на кастом кнопку (те что в архиве). При простое должна быть видна кнопка 2.png, а при нажатии переключатся на 1.png, и соответственно после нажатия ползунок с загрузкой должен работать. Спасибо заранее.

Post's attachments

test.rar 8.43 kb, 5 downloads since 2017-02-01 

You don't have the permssions to download the attachments of this post.

2

Re: AHK: Замена обычной кнопки на custom (img) кнопку

ButtonTexture1 := {normal:LoadPicture("2.png")	,	clicked:LoadPicture("1.png")}

Gui, Color, c161643
Gui, Add, Picture, xp+20 yp+250 gButtonStartNorecoil HWNDID_BT1 , % "HBITMAP:*" ButtonTexture1.normal
Gui, Add, Progress, ce0760b vMyProgress w416 Background161643
Gui, Add, Text, cd0cdd8 vMyText wp
Gui, Show, w450 h350, Тут название окна
return

ButtonStartNorecoil:

GuiControl,, MyProgress, 0
GuiControl, , % ID_BT1 , % "HBITMAP:*" ButtonTexture1.clicked

Loop, %A_WinDir%\*.*
{
    if A_Index = 100
        break
    GuiControl,, MyProgress, +5
    GuiControl,, MyText, %A_LoopFileName%
    Sleep 50
}
GuiControl,, MyText, Тут текст после нажатия.
GuiControl, , % ID_BT1 , % "HBITMAP:*" ButtonTexture1.normal
return

GuiClose:
Gui, Cancel