Page 1 of 2
Roman Clock
Posted: 31 Dec 2017, 12:36
by wolf_II
I have been playing around with GDIP+ and roman numerals.
The script also contains a function called
Zoom(), with the AHK version 1.1.27, it
can be renamed to
Scale()
Re: Roman Clock
Posted: 18 Jan 2018, 06:17
by Helgef
Hello
wolf_II
This doesn't work for me on win7, I believe it is beacuse of the combination of some of the styles and setparent, it requires win 10 if irc.
Re: Roman Clock
Posted: 18 Jan 2018, 10:05
by wolf_II
Oops, I remember now. sorry.
I really should look into moving the "canvas" with some other method. I look how you moved the circles or something a while back.
I am just working on Pong now, and it is also using setparent to a GuiControl
. I'm glad you mention the Win7 problem again.
If I get anywhere, I (c|s)hould update my spinner as well. And then see how that breaks "Anagrams" (hopefully it would not break anything).
Re: Roman Clock
Posted: 18 Jan 2018, 10:17
by wolf_II
Edit: I forgot in case I read it before, does this work in Win7?
Code: Select all
#NoEnv
#SingleInstance, Force
CoordMode, Mouse, Screen
r := 50, d := 100
Gui, +AlwaysOnTop ; always on top
Gui, -Caption ; no titlebar
Gui, +Owner ; no taskbar button
Gui, +hWndhGui ; handle
Gui, +E0x00000020 ; WS_EX_TRANSPARENT (click through)
Gui, +E0x00080000 ; WS_EX_LAYERED
Gui, Show, NA
Gdip_Startup()
hDC := CreateCompatibleDC()
hBM := CreateDIBSection(d, d)
oBM := SelectObject(hDC, hBM)
Graph := Gdip_GraphicsFromHdc(hDC)
Brush := Gdip_BrushCreateSolid(0x40FFFF00) ; (alpha) RGB
Return
;-------------------------------------------------------------------------------
F12:: ; toggle circle on/off
;-------------------------------------------------------------------------------
If Toggle := !Toggle {
Gdip_FillEllipse(Graph, Brush, 0, 0, d, d)
SetTimer, Update, 10
}
Else {
SetTimer, Update, Off
Gdip_GraphicsClear(Graph)
UpdateLayeredWindow(hGui, hDC, mX-r, mY-r, d, d)
}
Return
;-------------------------------------------------------------------------------
Update: ; update layered window
;-------------------------------------------------------------------------------
MouseGetPos, mX, mY
UpdateLayeredWindow(hGui, hDC, mX-r, mY-r, d, d)
Return
In this script, the styles are used, but SetParent is not.
It looks like I can position the graphic using
UpdateLayeredWindow
Re: Roman Clock
Posted: 18 Jan 2018, 11:32
by Helgef
I see a transparent circle
Cheers.
Re: Roman Clock
Posted: 18 Jan 2018, 12:03
by wolf_II
Thx for the feedback. I'll start rewriting the code.
Re: Roman Clock
Posted: 18 Jan 2018, 16:12
by wolf_II
This might work on Win7, I can't tell though.
- removed the nested Gui
- fixed style "Neutral" which got broken along the way. Missing colour definitions default to black now.
PS: Not implemented yet: adding
SetWinDelay, -1 to the auto-execute section seems to help smooth zooming.
Re: Roman Clock
Posted: 18 Jan 2018, 17:06
by Helgef
Great, it works!
I notice a small
border at the top and left edge, I see that
Code: Select all
Gdip_FillRectangle(pGraphics, Brush.Back, 0, 0, Width-1, Height-1)
adds border to bottom and right, and
Code: Select all
Gdip_FillRectangle(pGraphics, Brush.Back, -1, -1, Width+1, Height+1)
removes border.
Indeed
setwindelay -1 seems to smoothen the zoom.
Cheers.
Re: Roman Clock
Posted: 18 Jan 2018, 17:33
by wolf_II
Thanks for testing!
And for putting the final touch. I like the border all around.
Re: Roman Clock
Posted: 18 Jan 2018, 17:38
by Helgef
Me too
Re: Roman Clock
Posted: 18 Jan 2018, 17:50
by burque505
Hi wolf_II,
It works great for me with AHK_H U32 1.1.27.06 and AHK_L U32 1.1.27.06. 64-bit AHKs show a blank rectangle, probably due to my lib setup.
As a workaround I did added the following:
In Roman Clock.ahk:
Find:
Replace:
Find:
Replace:
My "Include" folder (the one below the main script, that is) now contains these files:
Code: Select all
01/18/2018 08:54 PM 1,457 Create.ahk
01/18/2018 09:53 PM 2,430 Events.ahk
01/18/2018 09:04 PM 1,930 Gdip.Helper.ahk
12/18/2017 06:29 PM 131,708 Gdip_All.ahk
01/18/2018 07:01 PM 1,946 INI.Handler.ahk
01/18/2018 09:57 PM 6,256 MainCode.ahk
It now works for me on Win7, 64-bit, AHK_L U32 or U64, AHK_H U32 or U64, version 1.1.27.06 for all.
The Gdip_All.ahk I used is attached.
Thanks very much for this script, I like it a lot!
regards,
burque505
Re: Roman Clock
Posted: 18 Jan 2018, 17:53
by Helgef
@ burque505, I have renamed Gdip_All.ahk to Gdip.ahk and put it in my user lib, it works for both ahk 32 and 64.
Cheers.
Re: Roman Clock
Posted: 18 Jan 2018, 17:56
by burque505
Cool, Helgef, thanks! Do you think that'll work for most scripts that ask for Gdip.ahk?
Re: Roman Clock
Posted: 18 Jan 2018, 18:02
by Helgef
I never had a problem which I fixed by using
gdip.ahk instead.
Re: Roman Clock
Posted: 18 Jan 2018, 18:04
by wolf_II
@
burque505, I'm glad you like it!
Re: Roman Clock
Posted: 18 Jan 2018, 18:05
by burque505
It's in my startup folder now. And Helgef, thanks again for that Gdip tip.
Re: Roman Clock
Posted: 18 Jan 2018, 18:11
by Helgef
with the AHK version 1.1.27, it can be renamed to Scale()
Hehe, I remember that
Re: Roman Clock
Posted: 18 Jan 2018, 18:39
by burque505
In Create.ahk, I changed
Code: Select all
;-------------------------------------------------------------------------------
GuiCreate: ; create the graphical user interface
;-------------------------------------------------------------------------------
Gui, +hwndhClock -Caption
hDC_Window := GetDC(hClock)
To:
Code: Select all
;-------------------------------------------------------------------------------
GuiCreate: ; create the graphical user interface
;-------------------------------------------------------------------------------
Gui, +hwndhClock -Caption +ToolWindow
hDC_Window := GetDC(hClock)
No taskbar icon this way, which I prefer.
Regards,
burque505
Re: Roman Clock
Posted: 18 Jan 2018, 19:13
by wolf_II
You could also try +Owner
+ToolWindow kills two birds at once: no taskbar button and no more Alt-Talbbing to reach the window.
+Owner removes only the taskbar button, which is my preference.
Re: Roman Clock
Posted: 18 Jan 2018, 21:33
by burque505
wolf_II, that sounds better. I'll change it.
Thanks!