<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Изменение цвета Hotkey в GUI]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=15117</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=15117&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Изменение цвета Hotkey в GUI».]]></description>
		<lastBuildDate>Mon, 06 Jan 2020 16:28:35 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Изменение цвета Hotkey в GUI]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=137176#p137176</link>
			<description><![CDATA[<p>Костыль вроде ничего работает. </p><div class="codebox"><pre><code>

#NoEnv
#SingleInstance Force   
 
Gui, Font, s16, Comic Sans MS

Gui, Add, Text, Center hwndhText1 gText vTextHotkey1 w222, Нет
Gui, Add, Text, Center hwndhText2 gText vTextHotkey2 wp, Нет

Gui, Add, Hotkey, vHotkey1 gHotkey  w0 h0
Gui, Add, Hotkey, vHotkey2 gHotkey wp hp

SetStaticColor(hText1, 0x0000FF, 0xFFFFFF) 
SetStaticColor(hText2, 0d0d0d, 0xFFFFFF) 

Gui, Show
Return
 
Text() {  
	GuiControl, Focus, % SubStr(A_GuiControl, 5)
}

Hotkey() {   
	Instr(%A_GuiControl%, &quot;^&quot;) &amp;&amp; (str .= &quot;Ctrl + &quot;)
	Instr(%A_GuiControl%, &quot;+&quot;) &amp;&amp; (str .= &quot;Shift + &quot;)
	Instr(%A_GuiControl%, &quot;!&quot;) &amp;&amp; (str .= &quot;Alt + &quot;)
	HK := str RegExReplace(Format(&quot;{:U}&quot;, %A_GuiControl%), &quot;[\+!\^]&quot;) 
	GuiControl, , Text%A_GuiControl%, % HK = &quot;&quot; ? &quot;Нет&quot; : HK
} 

GuiClose() {
    ExitApp
}


;  http://forum.script-coding.com/viewtopic.php?pid=101917#p101917

SetStaticColor(hStatic, b_color, f_color)
{
	static arr := [], GWL_WNDPROC := -4
	hGui := DllCall(&quot;GetParent&quot;, Ptr, hStatic, Ptr)
	if !arr.HasKey(hGui)  {
		arr[hGui] := {}, arr[hGui].Statics := []
		arr[hGui].ProcOld := DllCall(&quot;SetWindowLong&quot; . (A_PtrSize = 8 ? &quot;Ptr&quot; : &quot;&quot;), Ptr, hGui, Int, GWL_WNDPROC
												, Ptr, RegisterCallback(&quot;WindowProc&quot;, &quot;&quot;, 4, Object(arr[hGui])), Ptr)
	}
	else if arr[hGui].Statics.HasKey(hStatic)
		DllCall(&quot;DeleteObject&quot;, Ptr, arr[hGui].Statics[hStatic].hBrush)
	arr[hGui].Statics[hStatic] := { b_color: Rgb2Bgr(b_color), f_color: Rgb2Bgr(f_color)
											, hBrush: DllCall(&quot;CreateSolidBrush&quot;, UInt, Rgb2Bgr(b_color), Ptr) }
	WinSet, Redraw,, ahk_id %hGui%
}

WindowProc(hwnd, uMsg, wParam, lParam)
{
	Critical
	static WM_CTLCOLORSTATIC := 0x138
	obj := Object(A_EventInfo)
	if (uMsg = WM_CTLCOLORSTATIC &amp;&amp; k := obj.Statics[lParam])  {
		DllCall(&quot;SetBkColor&quot;, Ptr, wParam, UInt, k.b_color)
		DllCall(&quot;SetTextColor&quot;, Ptr, wParam, UInt, k.f_color)
		Return k.hBrush
	}
	Return DllCall(&quot;CallWindowProc&quot;, Ptr, obj.ProcOld, Ptr, hwnd, UInt, uMsg, Ptr, wParam, Ptr, lParam)
}
	
Rgb2Bgr(color)
{
	Return (color &amp; 0xff) &lt;&lt; 16 | ((color &gt;&gt; 8) &amp; 0xff) &lt;&lt; 8 | color &gt;&gt; 16
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Mon, 06 Jan 2020 16:28:35 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=137176#p137176</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Изменение цвета Hotkey в GUI]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=137172#p137172</link>
			<description><![CDATA[<p>Может через NET можно?<br /><a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.control.backcolor?view=netframework-4.8#System_Windows_Forms_Control_BackColor">https://docs.microsoft.com/en-us/dotnet … _BackColor</a></p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 06 Jan 2020 15:44:33 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=137172#p137172</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Изменение цвета Hotkey в GUI]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=137170#p137170</link>
			<description><![CDATA[<p>У Hotkey фон так просто не изменить. Можно попробовать спрятать Hotkey и сделать Text, который будет дублировать его содержимое. А уже у Text можно изменять фон.</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Mon, 06 Jan 2020 15:02:00 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=137170#p137170</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Изменение цвета Hotkey в GUI]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=137169#p137169</link>
			<description><![CDATA[<p>По этой ссылке тяжело будет найти. Но даже если покопаться, там есть пример для Edit со стилем ReadOnly, но это не подойдёт для контрола Hotkey, если это вообще возможно.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Mon, 06 Jan 2020 14:46:29 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=137169#p137169</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Изменение цвета Hotkey в GUI]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=137166#p137166</link>
			<description><![CDATA[<p><a href="http://forum.script-coding.com/viewtopic.php?id=8104">http://forum.script-coding.com/viewtopic.php?id=8104</a><br />И точку уберите в названии темы, а то нагорит.</p>]]></description>
			<author><![CDATA[null@example.com (Foma)]]></author>
			<pubDate>Sun, 05 Jan 2020 20:18:36 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=137166#p137166</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Изменение цвета Hotkey в GUI]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=137165#p137165</link>
			<description><![CDATA[<p>Искал изменение цвета хоткея в гуи, нашёл только изменение цвета edit, пришлось обратится сюда.<br />Дело в том, что мне нужно заменить стандартный белый цвет <span class="postimg"><img src="https://www.autohotkey.com/docs/static/ctrl_hotkey.png" alt="https://www.autohotkey.com/docs/static/ctrl_hotkey.png" /></span> на чёрный (0d0d0d) в моём гуи.<br />Заранее спасибо!</p>]]></description>
			<author><![CDATA[null@example.com (Dozilius)]]></author>
			<pubDate>Sun, 05 Jan 2020 20:13:07 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=137165#p137165</guid>
		</item>
	</channel>
</rss>
