<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Соединение GUI элементов]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=11136</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11136&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Соединение GUI элементов».]]></description>
		<lastBuildDate>Thu, 10 Dec 2015 20:08:56 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Соединение GUI элементов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=99612#p99612</link>
			<description><![CDATA[<p>Я бы использовал OnMessage:<br /></p><div class="codebox"><pre><code>OnMessage(WM_LBUTTONDOWN:=0x201, &quot;LBUTTONDOWN&quot;)
OnMessage(WM_LBUTTONUP:=0x202, &quot;LBUTTONUP&quot;)
return

LBUTTONDOWN(wParam, lParam) {
    ; X := lParam &amp; 0xFFFF
    ; Y := lParam &gt;&gt; 16
	OnMessage	(WM_MOUSEMOVE:=0x200, &quot;MouseMove&quot;) ; при зажатии ЛКМ, начинаем отслеживать перемещение мыши и синхр. перемещение окна.
; Строго говоря, они могут быть не связаны, например если окно можно двигать с клавиатуры.
}
LBUTTONUP() {
	OnMessage	(WM_MOUSEMOVE:=0x200)
}
MouseMove() {
	WinGetPos, x, y,,, MyGUI1
	WinMove, MyGUI2,, x, y
	WinMove, MyGUI3,, x, y
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Thu, 10 Dec 2015 20:08:56 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=99612#p99612</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Соединение GUI элементов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=99608#p99608</link>
			<description><![CDATA[<p>Написал такие часы:<br /></p><div class="codebox"><pre><code>
#include cir.ahk
#include gdip.ahk
#SingleInstance Force
progHour := new CircleProgressClass({BarDiameter: 110, BarThickness: 10, BackgroundColor: 0})
progMinute := new CircleProgressClass({BarDiameter: 85, BarThickness: 8, BackgroundColor: 0})
progSecond := new CircleProgressClass({BarDiameter: 70, BarThickness: 6, BackgroundColor: 0, TextSize: 15, TextFont: &quot;Arial&quot;})
SetTimer, updateTime, 500
return
 
updateTime:
{
	FormatTime, time,, HH:mm
	FormatTime, hr,, h
	progSecond.Update(a_sec*1.666, time)
	progMinute.Update(a_min*1.666)
	progHour.Update(hr*8.333333333333333)
	return
}
 
Esc::
	ExitApp
</code></pre></div><p>Cir.ahk:<br /></p><div class="codebox"><pre><code>
class CircleProgressClass {		; http://ahkscript.org/boards/viewtopic.php?p=41794#p41794
	; Credits: Bruttosozialprodukt, Learning one. This code is public domain.
	static Version := 1.04
	__New(Options=&quot;&quot;) {
		this.BarDiameter := (Options.HasKey(&quot;BarDiameter&quot;) = 1) ? Options.BarDiameter : 110
		this.BarThickness := (Options.HasKey(&quot;BarThickness&quot;) = 1) ? Options.BarThickness : 16
		this.BarColor := (Options.HasKey(&quot;BarColor&quot;) = 1) ? Options.BarColor : &quot;ddff5100&quot; ; CHANGE COLOR HERE!!!!!!!!!!!!!!!!!!
		this.BackgroundColor := (Options.HasKey(&quot;BackgroundColor&quot;) = 1) ? Options.BackgroundColor : &quot;ffffffff&quot;
		this.TextColor := (Options.HasKey(&quot;TextColor&quot;) = 1) ? Options.TextColor : &quot;ee000000&quot;
		this.TextSize := (Options.HasKey(&quot;TextSize&quot;) = 1) ? Options.TextSize : 11
		this.TextRendering := (Options.HasKey(&quot;TextRendering&quot;) = 1) ? Options.TextRendering : 5
		this.TextFont := (Options.HasKey(&quot;TextFont&quot;) = 1) ? Options.TextFont : &quot;Arial&quot;
		this.TextStyle := (Options.HasKey(&quot;TextStyle&quot;) = 1) ? Options.TextStyle : &quot;&quot;									; you can use for example  &quot;Bold Italic&quot;
		this.X := (Options.HasKey(&quot;X&quot;) = 1) ? Options.X : Round(A_ScreenWidth/2-this.BarDiameter/2-this.BarThickness)	; centered is defualt
		this.Y := (Options.HasKey(&quot;Y&quot;) = 1) ? Options.Y : Round(A_ScreenHeight/2-this.BarDiameter/2-this.BarThickness)	; centered is defualt
		this.W := this.BarDiameter+this.BarThickness*2+2	; it&#039;s good to add 2 extra pixels
		;this.UseClickThrough := (Options.HasKey(&quot;UseClickThrough&quot;) = 1) ? Options.UseClickThrough : 1					; 1 = use it, 0 = don&#039;t use it
 
		Gui, New, +Hwndhwnd
		Gui %hwnd%: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
		Gui %hwnd%: Show, NA
        this.hPos := hPos, this.hwnd := hwnd, this.Name := Name
        OnMessage(0x201,  this.WM_LBUTTONDOWN.Bind(this))
		;if (this.UseClickThrough = 1)
		;	WinSet, ExStyle, +0x20, % &quot;ahk_id &quot; hwnd	; click through style
 
		hbm := CreateDIBSection(this.W, this.W), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
		pPen:=Gdip_CreatePen(&quot;0x&quot; this.BarColor, this.BarThickness)
		if (pPen = 0) {	; GDI+ is not started up - start it up now and shut it down in __Delete() automatically.
			pToken := Gdip_Startup()
			pPen:=Gdip_CreatePen(&quot;0x&quot; this.BarColor, this.BarThickness)	; call it again (with GDI+ started up now)
		}
		G := Gdip_GraphicsFromHDC(hdc), Gdip_SetSmoothingMode(G, 4)
 
		if (this.BackgroundColor &gt; 0)
			pBrush:=Gdip_BrushCreateSolid(&quot;0x&quot; this.BackgroundColor)
 
		this.hwnd := hwnd, this.hdc := hdc, this.obm := obm, this.hbm := hbm, this.pPen := pPen, this.pBrush := pBrush, this.G := G, this.pToken := pToken
	}
	Update(Percent=0, Text=&quot;&quot;) {
		Gdip_GraphicsClear(this.G)		
		if (this.BackgroundColor &gt; 0)
			Gdip_FillEllipse(this.G, this.pBrush, this.BarThickness+1, this.BarThickness+1, this.BarDiameter,this.BarDiameter)
		if (Percent&gt;0)
			Gdip_DrawArc(this.G, this.pPen, Round(this.BarThickness/2)+1,  Round(this.BarThickness/2)+1, this.BarDiameter+this.BarThickness, this.BarDiameter+this.BarThickness, 270, Round(360/100*percent))
		if (Text!=&quot;&quot;) {
			Options := Trim(&quot;x1 y1 w&quot; this.W-2 &quot; h&quot; this.W-2 &quot; Center Vcenter r&quot; this.TextRendering &quot; s&quot; this.TextSize &quot; c&quot; this.TextColor A_Space this.TextStyle)
			Gdip_TextToGraphics(this.G, Text, Options, this.TextFont)
		}
		;pControlPen:=Gdip_CreatePen(&quot;0xffff0000&quot;, 1), Gdip_DrawRectangle(this.G, pControlPen, 1, 1, this.W-2,this.W-2), Gdip_DeletePen(pControlPen)
		UpdateLayeredWindow(this.hwnd, this.hdc, this.X, this.Y, this.W, this.W)
	}
	Clear() {	; Just clears the graphics and updates layered window. Doesn&#039;t destroy object nor clear resources.
		Gdip_GraphicsClear(this.G)
		UpdateLayeredWindow(this.hwnd, this.hdc, this.X, this.Y, this.W, this.W)
	}
	__Delete() {
		Gdip_DeletePen(this.pPen)
		if (this.BackgroundColor &gt; 0)
			Gdip_DeleteBrush(this.pBrush)
		Gdip_DeleteGraphics(this.G)
		SelectObject(this.hdc, this.obm)
		DeleteObject(this.hbm)
		DeleteDC(this.hdc)
		if (this.pToken != &quot;&quot;) 	; GDI+ was obviously automatically started up in __New(), and therefore shut it down automatically now
			Gdip_Shutdown(this.pToken)
		hwnd := this.hwnd
		Gui %hwnd%: Destroy
	}
    WM_LBUTTONDOWN() {
        PostMessage, 0xA1, 2
        KeyWait, LButton
        WinGetPos, x,y,,, % &quot;ahk_id &quot; this.hwnd
        GuiControl, % this.hwnd &quot;:&quot;, % this.hPos, % x &quot;, &quot; y
        this.X := x
        this.Y := y
        UpdateLayeredWindow(this.hwnd, this.hdc, X, Y, this.W, this.W)
    }
}
</code></pre></div><p><a href="http://www.autohotkey.net/~tic/Gdip.ahk">Gdip.ahk</a></p><p>Скрипт создает 3 круга: часы, минуты, секунды. В центре создается текст с временем в формате 22:00<br />При клике на один из кругов, его можно переместить. Но тут и появилась проблема: каждый круг перемещается по отдельности.</p><p>Как можно &quot;склеить&quot; все gui вместе, чтобы перемещая, например часовой круг, перемещались все остальные?</p>]]></description>
			<author><![CDATA[null@example.com (ghost29)]]></author>
			<pubDate>Thu, 10 Dec 2015 19:08:33 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=99608#p99608</guid>
		</item>
	</channel>
</rss>
