<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Изменить цвет текста GUI Static]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16683&amp;type=atom" />
	<updated>2021-10-29T08:26:04Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16683</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста GUI Static]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150299#p150299" />
			<content type="html"><![CDATA[<p>Спасибо Тебе БОЛЬШОЕ!</p>]]></content>
			<author>
				<name><![CDATA[Шикарная услуга плана]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40534</uri>
			</author>
			<updated>2021-10-29T08:26:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150299#p150299</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста GUI Static]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150239#p150239" />
			<content type="html"><![CDATA[<p>Тогда немного посложнее:<br /></p><div class="codebox"><pre><code>Progress, CTGray CBBlue, % &quot; &quot;, Installing..., Draft Installation

Loop, Files, %A_WinDir%\system32\*.*
{
   Progress, % A_Index, % A_LoopFileName, Installing..., Draft Installation
   if !hStatic
      ControlGet, hStatic, hwnd,, Static1, Draft Installation ahk_class AutoHotkey2
   if (A_Index = 20)
      StaticColor.Set(hStatic,, 0x88AAFF)
   if (A_Index = 50)
      StaticColor.Set(hStatic,, 0xDD00)
   if (A_Index = 75)
      StaticColor.Set(hStatic,, 0xBBAA00)
   Sleep, 50
} until A_Index = 100

StaticColor.Set(hStatic)
Progress,,, Complete!
Sleep, 1000
ExitApp

class StaticColor
{
   static arr := [], WM_CTLCOLORSTATIC := ObjBindMethod(StaticColor, &quot;_WM_CTLCOLORSTATIC&quot;)
        
   Set(hStatic, b_color := &quot;&quot;, f_color := &quot;&quot;) {
      if (b_color = &quot;&quot; &amp;&amp; f_color = &quot;&quot;)
         this.arr.Delete(hStatic), ( !this.arr.Count() &amp;&amp; init := 0 )
      else {
         ( !this.arr.Count() &amp;&amp; init := 1 )
         for k, v in [&quot;b&quot;, &quot;f&quot;]
            %v%_color := %v%_color &gt;&gt; 16 | %v%_color &amp; 0xFF00 | (%v%_color &amp; 0xFF) &lt;&lt; 16
         this.arr[hStatic] := {b: b_color, f: f_color}
      }
      ( init != &quot;&quot; &amp;&amp; OnMessage(0x138, this.WM_CTLCOLORSTATIC, init) )
      DllCall(&quot;InvalidateRect&quot;, &quot;Ptr&quot;, hStatic, &quot;Ptr&quot;, 0, &quot;Int&quot;, true)
   }
   
   _WM_CTLCOLORSTATIC(wp, lp) {
      static TRANSPARENT := 1, NULL_BRUSH := 5, DC_BRUSH := 18
      if !clr := this.arr[lp]
         Return
      ( clr.f != &quot;&quot; &amp;&amp; DllCall(&quot;SetTextColor&quot;, &quot;Ptr&quot;, wp, &quot;UInt&quot;, clr.f) )
      if (clr.b = &quot;&quot;)
         DllCall(&quot;SetBkMode&quot;, &quot;Ptr&quot;, wp, &quot;UInt&quot;, TRANSPARENT)
      else {
         DllCall(&quot;SetBkColor&quot;, &quot;Ptr&quot;, wp, &quot;UInt&quot;, clr.b)
         DllCall(&quot;SetDCBrushColor&quot;, &quot;Ptr&quot;, wp, &quot;UInt&quot;, clr.b)
      }
      Return DllCall(&quot;GetStockObject&quot;, &quot;UInt&quot;, clr.b = &quot;&quot; ? NULL_BRUSH : DC_BRUSH, &quot;Ptr&quot;)
   }
}</code></pre></div><div class="quotebox"><cite>Шикарная услуга плана пишет:</cite><blockquote><p>progress 8 за что отвечает, не нашел документацию?</p></blockquote></div><p>Читайте <a href="https://www.autohotkey.com/docs/commands/Progress.htm#Remarks">здесь</a>.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-27T17:52:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150239#p150239</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста GUI Static]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150233#p150233" />
			<content type="html"><![CDATA[<p>Связано так, что тексты, добавленные таким образом как коде, если просмотреть через ahkspy, классифицируются как static.</p>]]></content>
			<author>
				<name><![CDATA[Шикарная услуга плана]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40534</uri>
			</author>
			<updated>2021-10-27T11:16:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150233#p150233</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста GUI Static]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150231#p150231" />
			<content type="html"><![CDATA[<p>А как это связано с заголовком темы?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-27T10:50:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150231#p150231</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста GUI Static]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150227#p150227" />
			<content type="html"><![CDATA[<p>Спасибо.</p><p>Я работаю со старым кодом, там текст был добавлен через прогрессбар, сам прогрессбар цвет меняю через сэндмесседж и это работает, впрочем, лучше код:<br /></p><div class="codebox"><pre><code>
#Persistent
#SingleInstance, force

Progress, 8:C11 ZH20 WM400 WS600  CT00FF00 CWFFFF00 Hide, sub text, header text
Progress, 8:69
Progress, 8:SHOW
</code></pre></div><p>И, кстати, вопрос, progress 8 за что отвечает, не нашел документацию?</p>]]></content>
			<author>
				<name><![CDATA[Шикарная услуга плана]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40534</uri>
			</author>
			<updated>2021-10-27T08:06:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150227#p150227</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Изменить цвет текста GUI Static]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150226#p150226" />
			<content type="html"><![CDATA[<p>Если нужно, чтобы текст был изначально другого цвета, тогда так:<br /></p><div class="codebox"><pre><code>Gui, Font, s24
Gui, Add, Text, cRed, Hello, World!
Gui, Show</code></pre></div><p>Если менять потом:<br /></p><div class="codebox"><pre><code>Gui, Font, s24
Gui, Add, Text, vMyText, Hello, World!
Gui, Show

Loop 3 {
   Sleep, 500
   Gui, Font, cRed
   GuiControl, Font, MyText
   Sleep, 500
   Gui, Font, cDefault
   GuiControl, Font, MyText
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-27T06:37:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150226#p150226</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Изменить цвет текста GUI Static]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150225#p150225" />
			<content type="html"><![CDATA[<p>Доброе утро!</p><p>Создаю GUI с текстовым элементом, нужно поменять цвет текста с черного на красный.<br />Есть рабочий пример? Копал send message 0x0138, но, извиняюсь, хрен там, просто не работает и все тут!<br />Не так это просто, как кажется на первый взгляд.</p>]]></content>
			<author>
				<name><![CDATA[Шикарная услуга плана]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40534</uri>
			</author>
			<updated>2021-10-27T06:20:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150225#p150225</id>
		</entry>
</feed>
