顏色

遇到了问题?请先进行搜索(中文和英文),然后在此提问

Moderators: tmplinshi, arcticir

Marcosa1020
Posts: 168
Joined: 23 Sep 2015, 19:15

顏色

10 Apr 2016, 21:22

請問Button1可以改顏色嗎? 我希望讓1改成其它顏色。
謝謝。

Gui +AlwaysOnTop
;Gui, +E0x08000000 ;WS_EX_NOACTIVATE = 0x08000000
Gui, Font, S10 C000000 , Tahoma
Gui, Show, x131 y91 h153 w303,
Gui, Font, S09 cFF0000 , Tahoma
Gui, Add, Tab, x-2 y0 w313 h153 , Page1
Gui, Font, S16 c000000 , Tahoma
Gui, Add, Button, x209 y88 w30 h30,1
GuiClose:
ExitApp
garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: 顏色

11 Apr 2016, 01:36

Color Button

Code: Select all

;- Color Button
Gui +AlwaysOnTop
;Gui, +E0x08000000 ;WS_EX_NOACTIVATE = 0x08000000
Gui, Font, S10 C000000 , Tahoma
Gui, Show, x131 y91 h153 w303,Button_Test
Gui, Font, S09 cFF0000 , Tahoma
Gui, Add, Tab, x-2 y0 w313 h153 , Page1
Gui, Font, S16 c000000 , Tahoma

Gui,Add,Progress, x209 y88 w30 h30  Disabled BackgroundRed
Gui,Add,Text,     xp   yp  wp  hp   cYellow  BackgroundTrans Center 0x200 vBB1 gB1,1

return

GuiClose:
ExitApp

B1:
gui,submit,nohide
msgbox, 262208,BUTTON_TEST ,You selected Button = %a_guicontrol%,3
return
Marcosa1020
Posts: 168
Joined: 23 Sep 2015, 19:15

Re: 顏色

12 Apr 2016, 23:47

謝謝,但如果不用Msgbox輸出呢? 例如我開純文字檔按1, 輸出1 ??
garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: 顏色

13 Apr 2016, 13:53

see text in editfield , instead msgbox
or run,1.txt / 2.txt

Code: Select all

;-  2 Color Buttons
Gui +AlwaysOnTop
;Gui, +E0x08000000 ;WS_EX_NOACTIVATE = 0x08000000
Gui, Font, S10 C000000 , Tahoma
Gui, Show, x131 y91 h153 w303,Button_Test
Gui, Font, S09 cFF0000 , Tahoma
Gui, Add, Tab, x-2 y0 w313 h153 , Page1
Gui, Font, S16 c000000 , Tahoma

Gui,Add,Progress, x10  y110 w30 h30  Disabled BackgroundRed
Gui,Add,Text,     xp   yp  wp  hp   cYellow  BackgroundTrans Center 0x200 vBB1 gB1,1

Gui,Add,Progress, x100 y110 w30 h30  Disabled BackgroundGray
Gui,Add,Text,     xp   yp  wp  hp   cBlack  BackgroundTrans  Center 0x200 vBB2 gB2,2

Gui, Font, S12 , Lucida Console
Gui,add,edit, x10 y30 h70 w250 vED1 cGray
return

GuiClose:
ExitApp

B1:
gui,submit,nohide
GuiControl,1:,ED1,
;msgbox, 262208,BUTTON_TEST ,You selected Button = %a_guicontrol%,1
e1x=
(ltrim join`n
Text1---
next Line
)
GuiControl,1:,ED1,%e1x%
return

B2:
gui,submit,nohide
GuiControl,1:,ED1,
;msgbox, 262208,BUTTON_TEST ,You selected Button = %a_guicontrol%,1
e2x=
(ltrim join`n
Text2---
next Line
)
GuiControl,1:,ED1,%e2x%
return
Marcosa1020
Posts: 168
Joined: 23 Sep 2015, 19:15

Re: 顏色

13 Apr 2016, 19:02

Hi Garry,

首先感謝你花了這麼多時間幫助我。
11 Apr 2016, 14:36 這段程式會比較接近我的想法,但是它不能輸出訊息在Button_Test以外的地方。
比方說打開Website, Excel file, office 然後按數字鍵,可以輸出資訊到Website, Excel file, office.
我只會寫Button, 對於你寫的程式我還在理解中,所以仍需要你的幫助,再次感謝。

;- Color Button
Gui +AlwaysOnTop
;Gui, +E0x08000000 ;WS_EX_NOACTIVATE = 0x08000000
Gui, Font, S10 C000000 , Tahoma
Gui, Show, x131 y91 h153 w303,Button_Test
Gui, Font, S09 cFF0000 , Tahoma
Gui, Add, Tab, x-2 y0 w313 h153 , Page1
Gui, Font, S16 c000000 , Tahoma

Gui,Add,Progress, x209 y88 w30 h30 Disabled BackgroundRed
Gui,Add,Text, xp yp wp hp cYellow BackgroundTrans Center 0x200 vBB1 gB1,1

return

GuiClose:
ExitApp

;Data output ??
garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: 顏色

14 Apr 2016, 01:35

@marcosa1020,
I can't help ( lack of knowledge of programming and language )
just realized a color button
but many other users here in chinese forum can help
Marcosa1020
Posts: 168
Joined: 23 Sep 2015, 19:15

Re: 顏色

14 Apr 2016, 02:23

Garry,

Thank you so much.
aamii
Posts: 47
Joined: 23 May 2014, 03:50

Re: 顏色

17 Apr 2016, 06:53

就 “比方說打開Website, Excel file, office 然後按數字鍵,可以輸出資訊到Website, Excel file, office.” 而言。
实际上是另一个问题了。与“颜色按钮关系不大”

用上面garry的脚本,举一个简单的例子。
把B1标签下面的内容,修改成这样,在打开“记事本”的情况下,按1按钮。

B1:
ControlSetText,Edit1,我想送点文字进来,ahk_exe notepad.exe
return

-----------------------------------------------------
你需要下载一个中文帮助,了解一下G标签等。
Marcosa1020
Posts: 168
Joined: 23 Sep 2015, 19:15

Re: 顏色

18 Apr 2016, 07:24

你好,

我開啟記事本後按1還是沒有輸出,修改如下,請問我哪裡寫錯呢? 謝謝。

;- Color Button
Gui +AlwaysOnTop
;Gui, +E0x08000000 ;WS_EX_NOACTIVATE = 0x08000000
Gui, Font, S10 C000000 , Tahoma
Gui, Show, x131 y91 h153 w303,Button_Test
Gui, Font, S09 cFF0000 , Tahoma
Gui, Add, Tab, x-2 y0 w313 h153 , Page1
Gui, Font, S16 c000000 , Tahoma

Gui,Add,Progress, x209 y88 w30 h30 Disabled BackgroundRed
Gui,Add,Text, xp yp wp hp cYellow BackgroundTrans Center 0x200 vBB1 gB1,1

return

GuiClose:
ExitApp

B1:
ControlSetText,Edit1,我想送点文字进来,ahk_exe notepad.exe
return
garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: 顏色

18 Apr 2016, 16:00

added example with Controlsettext ( to notepad )

Code: Select all

;-  3 Color Buttons & Edit & Send To Notepad
;Gui +AlwaysOnTop
;Gui, +E0x08000000 ;WS_EX_NOACTIVATE = 0x08000000
i=0
Gui, Font, S10 C000000 , Tahoma
Gui, Show, x5 y5 h160 w310,Button_Test
Gui, Font, S09 cFF0000 , Tahoma
Gui, Add, Tab, x-2 y0 w313 h153 , Page1
Gui, Font, S16 c000000 , Tahoma

Gui,Add,Progress, x10  y110 w30  h30  Disabled BackgroundRed
Gui,Add,Text,     xp   yp   wp   hp   cYellow  BackgroundTrans Center 0x200 vBB1 gB1,1

Gui,Add,Progress, x100 y110 w30  h30  Disabled BackgroundGray
Gui,Add,Text,     xp   yp   wp   hp   cBlack  BackgroundTrans  Center 0x200 vBB2 gB2,2

Gui,Add,Progress, x200 y110 w100 h30  Disabled BackgroundGreen
Gui,Add,Text,     xp   yp   wp   hp   cBlack  BackgroundTrans  Center 0x200 vBB3 gB3,NotePad

Gui, Font, S12 , Lucida Console
Gui,add,edit, x10 y30 h70 w250 vED1 cGray
return

GuiClose:
ExitApp


B1:
gui,submit,nohide
GuiControl,1:,ED1,
;msgbox, 262208,BUTTON_TEST ,You selected Button = %a_guicontrol%,1
e1x=
(ltrim join`n
Text1---
next Line
)
GuiControl,1:,ED1,%e1x%
return


B2:
gui,submit,nohide
GuiControl,1:,ED1,
;msgbox, 262208,BUTTON_TEST ,You selected Button = %a_guicontrol%,1
e2x=
(ltrim join`n
Text2---
next Line
)
GuiControl,1:,ED1,%e2x%
return


B3:
gui,submit,nohide
GuiControl,1:,ED1,
pr=notepad
sc=ahk_class Notepad
i++
IfWinNotExist,%sc%
  {
  Run, %pr%,,,pid1
   WinWait,%SC%
  WinMove,%sc%,, 5, 190, 310, 200
  }
IfWinNotActive ,%SC%,,WinActivate,%SC%
  WinWaitActive,%SC%
text3=%i%_abcde`r`nFGHI`r`n
ControlSetText,Edit1,%text3%,%sc%
GuiControl,1:,ED1,%text3%
return
;=========================================================================
Marcosa1020
Posts: 168
Joined: 23 Sep 2015, 19:15

Re: 顏色

18 Apr 2016, 19:47

Hi Garry, aamii,

Thanks for your support.

Return to “请求帮助”

Who is online

Users browsing this forum: No registered users and 84 guests