0
私は、テキストフィールドに表示されるプログラムを作成しようとしています。これは、編集フィールドで指定されたx、y位置のカラー値です。ダイナミックテキストラベルを作成する方法autohotkey
問題は、1度だけ更新されてから更新されないという問題です。 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
はこの上でいくつかの助けが必要、ありがとう:)
によって
を交換し、私は '%vmyRGB%が' '%myRGBの%'であることを推測しますか? 'v'は変数オプションを指定するためだけに使用されます。詳細はドキュメントを参照してください。 – Blauhirn
あなたの問題が解決された場合は、この質問を受け入れられた回答としてここに記入してください。 – Blauhirn
はい私は問題を解決しましたが、2日以上待つ前に受け入れられたとマークすることはできません(おそらくそれは私自身の回答か、アカウントが新しいと思われるからです)。 +%myRGB%ではなく%vmyRGB%でもうまくいった理由は分かりませんが、私はそれを変更しました。 – PineApple34