<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13133&amp;type=atom" />
	<updated>2018-02-13T18:37:57Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13133</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123709#p123709" />
			<content type="html"><![CDATA[<p><strong>gosha.pudin</strong>, вашем коде первый таймер проверяет, тоже самое, что и второй, так как перед <em>Pic_check</em>: не стоит return.<br /><em>MouseGetPos, , , , TABLB, 2</em> сохраняет в переменную TABLB хендл контрола, а вы эту переменную сравниваете не с хендлом, а с содержимым контрола с картинкой (пустым значением).</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-02-13T18:37:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123709#p123709</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123698#p123698" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Gui, Add, Text, vText gDummy, Main text
Gui, Add, Pic, w32 h-1 vPic1 gDummy Icon28, shell32
Gui, Add, Pic, wp hp xp yp Hidden vPic2 gDummy Icon110, shell32
Gui, Show, w200 h100
OnMessage(0x200, &quot;WM_MOUSEMOVE&quot;)
Dummy:
Return

GuiClose:
   ExitApp

WM_MOUSEMOVE(wp, lp, msg, hwnd)  {
   static hover := {}
   if (wp = &quot;timer&quot;)  {
      MouseGetPos,,,, hControl, 2
      if (hControl != hwnd)  {
         SetTimer,, Delete
         hover[hwnd] := false
         
         if (msg = &quot;text&quot;)  {
            Gui, %lp%:Font, cDefault
            GuiControl, %lp%:Font, % hwnd
         }
         else  {
            GuiControl, %lp%:Hide, Pic2
            GuiControl, %lp%:Show, Pic1
         }
      }
   }
   else  {
      if ( A_GuiControl = &quot;Text&quot; &amp;&amp; !hover[hwnd] )  {
         hover[hwnd] := true
         Gui, Font, cRed
         GuiControl, Font, Text
         timer := Func(A_ThisFunc).Bind(&quot;timer&quot;, A_Gui, &quot;text&quot;, hwnd)
         SetTimer, % timer, 100
      }
      else if (A_GuiControl = &quot;Pic1&quot;)  {
         GuiControl, Hide, Pic1
         GuiControl, Show, Pic2
      }
      else if ( A_GuiControl = &quot;Pic2&quot; &amp;&amp; !hover[hwnd] )  {
         hover[hwnd] := true
         timer := Func(A_ThisFunc).Bind(&quot;timer&quot;, A_Gui, &quot;pic&quot;, hwnd)
         SetTimer, % timer, 100
      }
   }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-02-12T15:55:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123698#p123698</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123694#p123694" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Чтобы его адаптировать для графики нужно вначале понять как скрипт работает.<br />Для этого нужно почитать команды которые там используются, попытаться понять для чего они там нужны и если есть какие-то по ним вопросы задать их на форуме.</p></blockquote></div><p>Именно в данном контексте вопрос и был задан:<br /></p><div class="quotebox"><blockquote><p>… если не затруднит дать небольшое пояснение как задействовать действие при наведении курсора правильно?<br />Данный пример отлично работает с подсветкой текста, но нестабилен с графикой.<br /> </p><div class="codebox"><pre><code>
GUI, Add, Text, vMainText hwndMyText, Main text
GUI, Add, Picture, x20 y20 vMAIN1, C: \OFF.BMP
GUI, Add, Picture, x20 y20 vMAIN2, C:\ON.BMP
GUI, Show
SetTimer, Text_check , 100
SetTimer, Pic_check , 100
Return
Text_check:
MouseGetPos, , , , TABLA, 2
IF TABLA = %MyText%
{
Gui, Font, cRed
GuiControl, Font, MainText
}
Else
{
Gui, Font, cDefault
GuiControl, Font, MainText
}
Pic_check:
MouseGetPos, , , , TABLB, 2
If TABLB = %MAIN1%
{
GuiControl, Hide, MAIN1
GuiControl, Show, MAIN2
}
Else
{
GuiControl, Hide, MAIN2
GuiControl, Show, MAIN1
}
</code></pre></div><p>Почему в данной конструкции есть зависимость между <br /></p><div class="codebox"><pre><code>
MouseGetPos, , , , TABLA, 2
///
MouseGetPos, , , , TABLB, 2
</code></pre></div><p>И почему она пропадает при смене 2 на 1 в TABLB?<br />Возможно, я изначально использую не подходящие методы?<br />Cуществует более простой способ изменить картинку при наведении на нее курсора?</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[gosha.pudin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39051</uri>
			</author>
			<updated>2018-02-12T06:04:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123694#p123694</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123692#p123692" />
			<content type="html"><![CDATA[<p>Чтобы его адаптировать для графики нужно вначале понять как скрипт работает.<br />Для этого нужно почитать команды которые там используются, попытаться понять для чего они там нужны и если есть какие-то по ним вопросы задать их на форуме.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-02-11T22:42:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123692#p123692</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123691#p123691" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br />Ранние я приводил пример, наиболее удачной конструкции, но имеющей описанные выше недостатки.</p><p>Код который приведен Разработчиком <strong>teadrinker</strong> применим к тексту но адаптировать его для графики не вижу возможным, так как большая его часть использует Цвет и Шрифт.</p>]]></content>
			<author>
				<name><![CDATA[gosha.pudin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39051</uri>
			</author>
			<updated>2018-02-11T22:21:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123691#p123691</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123690#p123690" />
			<content type="html"><![CDATA[<p>Значит что-то не то делаете.<br />Приведите свой код.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-02-11T21:39:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123690#p123690</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123689#p123689" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong></p><p>Действительно, Я рассматривал этот вариант, но полноценной (корректной) работы добиться не удалось.<br />Данный пример хорошо работает с текстом, но к моему сожалению не получается применить его к картинке.</p>]]></content>
			<author>
				<name><![CDATA[gosha.pudin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39051</uri>
			</author>
			<updated>2018-02-11T21:32:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123689#p123689</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123686#p123686" />
			<content type="html"><![CDATA[<p>Изучайте вариант от <strong> teadrinker</strong>.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-02-11T20:52:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123686#p123686</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123685#p123685" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong><br />А существует возможность избежать использование: SetTimer?</p>]]></content>
			<author>
				<name><![CDATA[gosha.pudin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39051</uri>
			</author>
			<updated>2018-02-11T20:48:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123685#p123685</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123683#p123683" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, на XP работает. Возможно, если немного усложнить условия проверки, то и на 7ке заработает без мельканий.</p><p>Пример с картинкой плюс доработка против мельканий:<br /></p><div class="codebox"><pre><code>GUI, Add, Picture, vPicture1 Icon4 hwndMyPicture, %A_WinDir%\system32\shell32.dll
GUI, Show
SetTimer, Picture_check , 100
Return



Picture_check:
MouseGetPos, , , , OutputVarControl, 2

IF OutputVarControl = %MyPicture%
	{
	If flag != 5
		{
		GuiControl,, Picture1, *icon5 %A_WinDir%\system32\shell32.dll
		flag = 5
		}
	}

ELSE
	{
	If flag = 5
		{
		GuiControl,, Picture1, *icon4 %A_WinDir%\system32\shell32.dll
		flag = 4
		}
	}
Return




F5:: Reload</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2018-02-11T19:14:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123683#p123683</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123681#p123681" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong>, у меня в вашем коде надпись 11111111 постоянно мелькает (Win-7 Classic theme).</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-02-11T17:30:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123681#p123681</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123680#p123680" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ypppu пишет:</cite><blockquote><p>В моём сообщении в начале темы есть ссылка на код, в котором отслеживается ЭУ под курсором. Работает стабильно.</p></blockquote></div><p>Я ознакомился с данным примером, если не затруднит дать небольшое пояснение как задействовать действие при наведении курсора правильно?</p><p>Данный пример отлично работает с подсветкой текста, но нестабилен с графикой.<br /></p><div class="codebox"><pre><code>
GUI, Add, Text, vMainText hwndMyText, Main text
GUI, Add, Picture, x20 y20 vMAIN1, C:\OFF.BMP
GUI, Add, Picture, x20 y20 vMAIN2, C:\ON.BMP
GUI, Show
SetTimer, Text_check , 100
SetTimer, Pic_check , 100
Return
Text_check:
MouseGetPos, , , , TABLA, 2
IF TABLA = %MyText%
{
Gui, Font, cRed
GuiControl, Font, MainText
}
Else
{
Gui, Font, cDefault
GuiControl, Font, MainText
}
Pic_check:
MouseGetPos, , , , TABLB, 2
If TABLB = %MAIN1%
{
GuiControl, Hide, MAIN1
GuiControl, Show, MAIN2
}
Else
{
GuiControl, Hide, MAIN2
GuiControl, Show, MAIN1
}
</code></pre></div><p>Также не ясно почему в данной конструкции есть зависимость между:<br /></p><div class="codebox"><pre><code>
MouseGetPos, , , , TABLA, 2
///
MouseGetPos, , , , TABLB, 2
</code></pre></div><p>И почему она меняется при смене 2 на 1 в TABLB?<br />Возможно, я изначально использую не подходящие методы?<br />Существует более простой способ изменить картинку при наведении на нее курсора?</p><p>Осмелюсь предположить, что есть более простое решение без временной переменной…</p>]]></content>
			<author>
				<name><![CDATA[gosha.pudin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39051</uri>
			</author>
			<updated>2018-02-11T17:30:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123680#p123680</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123679#p123679" />
			<content type="html"><![CDATA[<p>В моём сообщении в начале темы есть ссылка на код, в котором отслеживается ЭУ под курсором. Работает стабильно.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2018-02-11T17:18:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123679#p123679</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123677#p123677" />
			<content type="html"><![CDATA[<p>Какой метод лучше использовать, чтобы получить схожий результат для изображения?</p><p>Чтобы картинка А при наведения на нее курсора мыши, менялось на картинку Б.</p>]]></content>
			<author>
				<name><![CDATA[gosha.pudin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39051</uri>
			</author>
			<updated>2018-02-11T15:59:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123677#p123677</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста в Gui под курсором мыши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=120633#p120633" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>А зачем добавлять несколько меток перехода?</p></blockquote></div><p>Просто эксперементировал. Хотел сделать запуск разных MsgBox из каждого текста.</p><div class="codebox"><pre><code>
   Gui, Add, Text, cBlue xp y+5 wp center vChangeColor%A_Index% gDummy1, I&#039;m blue
   Gui, Add, Text, cBlue xp y+5 wp center vChangeColor%A_Index% gDummy2, I&#039;m blue
   Gui, Add, Text, cBlue xp y+5 wp center vChangeColor%A_Index% gDummy3, I&#039;m blue

Dummy1:
	MsgBox  1
Return

Dummy2:
	MsgBox 2
Return

Dummy3:
	MsgBox 3
Return
</code></pre></div><p>Почему-то вываливается ошибка</p><p><strong>Alectric</strong> уже подсказал, что не так делал.</p><p>Надо было A_Index убрать.</p><p>Разобрался. Спасибо! Все работает.</p>]]></content>
			<author>
				<name><![CDATA[Mambr]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34398</uri>
			</author>
			<updated>2017-10-30T16:00:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=120633#p120633</id>
		</entry>
</feed>
