i have write for my HTPC-Center a litle Menu.
Move the Cursor-Key's to move and press enter to select.
Dater
;------------------------------------------------------------------------
; GDI-DEMO - HTPC-MENU - OpenSource - V.01 -Dater -
; AHK Version 1.0.48.05
;------------------------------------------------------------------------
#include gdip.ahk
#SingleInstance, Force
#NoEnv
SetBatchLines, -1
Process Priority,,High
SetWinDelay, -1
SetControlDelay, -1
;-----------------------------------------------------------------------------------------------------------------------------------------
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
;-----------------------------------------------------------------------------------------------------------------------------------------
;Filed 4 x 4 = 16
row=4
max=16
winwidth:=A_ScreenHeight-(A_ScreenHeight*0.25) ; 25% smaller ; or define the width 600 - 800 ...
winwidth:=winwidth+1
filedwidth:=(winwidth-1)/row
c1=0xff0993ea ; Color 1
c2=0xffbde5ff ; Color 2
imgtext=ARD,ZDF,3Sat,Hr3,XBMC,DVB`nViewer,RESTART`nHTPC`nSystem,Press,Enter,or,Move,Cursor,up,down,Left,right
StringSplit,imgtext,imgtext,`,,all
;Color-Loop-Efeckt
cc=0xffbde5ff,0xeebde5ff,0xddbde5ff,0xccbde5ff,0xbbbde5ff,0xaabde5ff,0x99bde5ff,0x88bde5ee,0x77bde5dd,0x66bde5cc,0x55bde5bb,0x66bde5cc,0x77bde5dd,0x88bde5ee,0x99bde5ff,0xaabde5ff,0xbbbde5ff,0xccbde5ff,0xddbde5ff,0xeebde5ff
StringSplit,cc,cc,`,,all
ccindex=1
ccindex_max:=cc0
Soundfreq=3500
;-----------------------------------------------------------------------------------------------------------------------------------------
Gui,1: +LastFound
Gui,1: Margin,0,0
Gui,1: Color,black,black
;Gui,1: +Border
Gui,1: +Border -Caption +AlwaysOnTop +ToolWindow
x=0
y=0
nr:=1
;-----------------------------------------------------------------------------------------------------------------------------------------
; Draw Buttons 4 x 4
loop,%row% {
loop,%row% {
Gui, 1: Add, Picture,x%x% y%y% w%filedwidth% h%filedwidth% 0xE vgdi_image%nr% gimg1
nr:=nr+1
x:=x+filedwidth
}
x:=0
y:=y+filedwidth
}
;-----------------------------------------------------------------------------------------------------------------------------------------
Gui, 1: Show,w%winwidth% h%winwidth%,GDI-DEMO - Dater
settimer,view,25
;-----------------------------------------------------------------------------------------------------------------------------------------
loop,200
{
sleep,1
Random, viewnummer , 1, 16
Random,ccindex,1,ccindex_max
WinSet,Transparent,%A_index%,GDI-DEMO - Dater
Random, viewnummer , 1, 16
Random,ccindex,1,ccindex_max
Random, viewnummer , 1, 16
Random,ccindex,1,ccindex_max
Random, viewnummer , 1, 16
Random,ccindex,1,ccindex_max
}
;-----------------------------------------------------------------------------------------------------------------------------------------
;Start at one
viewnummer:=1
loop,16
Gdip_SetImageButton(gdi_image%A_index%,c1,c2,imgtext%A_index%,filedwidth,filedwidth)
;-----------------------------------------------------------------------------------------------------------------------------------------
Hotkey,IfWinActive,GDI-DEMO - Dater
hotkey,UP,aa
hotkey,down,bb
hotkey,left,cc
hotkey,right,dd
hotkey,return,ende
Return
;-----------------------------------------------------------------------------------------------------------------------------------------
aa:
SoundBeep,%Soundfreq%,10
old_viewnummer:=viewnummer
if (viewnummer>row)
viewnummer:=viewnummer-row
else
viewnummer:=viewnummer+(max-row)
return
;------------------------------------------------------
bb:
SoundBeep,%Soundfreq%,10
old_viewnummer:=viewnummer
if (viewnummer<13) ; <---- Special !! No idee vor a Calc....Var
viewnummer:=viewnummer+row
else
viewnummer:=viewnummer-(max-row)
;gosub view
return
;------------------------------------------------------
cc:
SoundBeep,%Soundfreq%,10
old_viewnummer:=viewnummer
if (viewnummer>1)
viewnummer:=viewnummer-1
else
viewnummer:=viewnummer+max
return
;------------------------------------------------------
dd:
SoundBeep,%Soundfreq%,10
old_viewnummer:=viewnummer
if (viewnummer<max)
viewnummer:=viewnummer+1
else
viewnummer:=1
return
;-----------------------------------------------------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------------------------------------------------
view:
Gdip_SetImageButton(gdi_image%old_viewnummer%,c1,c2,imgtext%old_viewnummer%,filedwidth,filedwidth)
ccindex:=ccindex+1
if (ccindex=ccindex_max)
ccindex=1
Gdip_SetImageButton(gdi_image%viewnummer%,cc%ccindex%,c1,imgtext%viewnummer%,filedwidth,filedwidth)
return
;-----------------------------------------------------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------------------------------------------------
img1:
nr=%A_GuiControl%
StringReplace,nr,nr,gdi_image,,,
old_viewnummer:=viewnummer
viewnummer:=nr
return
;-----------------------------------------------------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------------------------------------------------
Gdip_SetImageButton(ByRef image,Foreground, Background=0x00000000, Text="", w=200,h=200)
{
Critical
GuiControlGet, hwnd, hwnd, image
;pBrushBack := Gdip_BrushCreateHatch(Foreground,Background, 5)
pBrushFront := Gdip_BrushCreateSolid(Foreground)
pBrushBack := Gdip_BrushCreateSolid(Background)
pBitmap := Gdip_CreateBitmap(w, h)
G := Gdip_GraphicsFromImage(pBitmap)
Gdip_SetSmoothingMode(G, 4)
Gdip_FillRectangle(G, pBrushBack, 0, 0,w, h)
Gdip_FillRoundedRectangle(G, pBrushFront, 8, 8, w-16,h-16,12)
Gdip_TextToGraphics(G,text, "x1 y50 s15p Center cff000000 r4 Bold","Arial",w,h)
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
SetImage(hwnd, hBitmap)
Gdip_DeleteBrush(pBrushFront)
Gdip_DeleteBrush(pBrushBack)
Gdip_DeleteGraphics(G)
Gdip_DisposeImage(pBitmap)
DeleteObject(hBitmap)
Return, 0
}
;-----------------------------------------------------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------------------------------------------------
ende:
esc::
select:=viewnummer
c1=0xff000000 ; Color 1
c2=0xffaaaaaa ; Color 2
loop,200
{
sleep,1
tr:=200-A_index
winwidth:=winwidth+1
Random, viewnummer , 1, 16
Random,ccindex,1,ccindex_max
if (select<>viewnummer)
gosub,view
WinSet,Transparent,%tr%,GDI-DEMO - Dater
Random, viewnummer , 1, 16
Random,ccindex,1,ccindex_max
if (select<>viewnummer)
gosub,view
}
Gdip_Shutdown(pToken)
msgbox,Feld NR =%select% Select
ExitApp




