如何创建动态文本标签 autohotkey

how to create dynamic text label autohotkey

我正在尝试创建一个程序,它将在文本标签中显示编辑字段中给出的 x、y 位置的颜色值。

问题是它只会工作一次,之后不会刷新。这不是值本身的问题,因为当我使用 MsgBox 时值已正确更新。

看我下面的代码:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#SingleInstance, force

Gui, Add, Text,, X ;xpos label
Gui, Add, Edit, vxpos Number ;xpos to be entered by user
Gui, Add, Text,, Y ;ypos label
Gui, Add, Edit, vypos Number ;ypos to be entered by user
Gui, Add, Button, Default, GetColor ;to get the color
Gui, Add, Text,, vmyRGB ;color value that should be displayed
Gui, Show, AutoSize
Return

ButtonGetColor: ;called when pressing the button
    Gui, Submit, NoHide ;retrieves values of my edit fields
    PixelGetColor, myColor, %xpos%, %ypos% ;pixelcolor in my myColor variable
    GuiControl,, vmyRGB, %myColor% ;updates my text field with the variable value, working once
    MsgBox, %myColor% ;checks the value of my variable, always working
Return

需要一些帮助,谢谢:)

好吧,在使用不同的关键字进行更多研究之后,我找到了一个解决方案:

正在替换

Gui, Add, Text,, vmyRGB ;color value that should be displayed

来自

Gui, Add, Text, vmyRGB, %myRGB% ;color value that should be displayed

并替换

GuiControl,, vmyRGB, %myColor% ;updates my text field with the variable value, working once

来自

GuiControl, Text, myRGB, %myColor% ;updates my text field with the variable value