电子手表

!addplugindir .
!include nsDialogs.nsh
!include WinMessages.nsh
!include "FileFunc.nsh"

Page Custom mypagecreate
Page InstFiles
OutFile "TimeFont_RoundFace.exe"

Var dlg
Var button
Var Font1
Var Label
Var Label2
Var Label3

!define WS_BORDER 0x00800000 ; рамка вокруг окна цифрового табло (не нужна на чёрном фоне)

Function .onInit
InitPluginsDir
File "/oname=$pluginsdir\DIGIFACE.ttf" "DIGIFACE.ttf"
System::Call 'GDI32::AddFontResourceEx(t"$pluginsdir\DIGIFACE.ttf",i 0x30,i0)'
File "/oname=$pluginsdir\Faux Snow BRK.ttf" "Faux Snow BRK.ttf"
System::Call 'GDI32::AddFontResourceEx(t"$pluginsdir\Faux Snow BRK.ttf",i 0x30,i0)'
FunctionEnd

Function .onGUIInit
; для перемещения окна за любую точку
MoveAnywhere::Hook
; окно всегда поверх
System::Call "user32::SetWindowPos(i$HWNDPARENT,i-1,i,i,i,i,i3)"
; убрать заголовок  
System::Call `user32::SetWindowLong(i$HWNDPARENT,i${GWL_STYLE},0x9480084C)i.R0`
; убрать пунктирную рамку границы при перетаскивании окна
System::Call "user32::SystemParametersInfo(i0x0025,i0,*i.R0,i0)"
System::Call "user32::SystemParametersInfo(i0x0025,i1,i0,i0)"
FunctionEnd

Function .onGUIEnd
System::Call "user32::SystemParametersInfo(i0x0025,iR0,i0,i0)"
FunctionEnd

Function mypagecreate
nsDialogs::Create 1018
Pop $dlg

; цвет фона страницы (круга)
SetCtlColors $HWNDPARENT "" 0x972FFF
SetCtlColors $dlg "" 0x972FFF

${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
System::Call 'user32::CreateWindowEx(i0,t "EDIT",t "$4 : $5 : $6",\
                      i${DEFAULT_STYLES}|${WS_BORDER},\
                      i5,i60,i170,i50,i$dlg,i222,i0,i0) i.R2'

SetCtlColors $R2 `0xFF0000` `0x000000`  ; цвет цифры, цвет фона

CreateFont $R9 "DIGIFACE" 27
SendMessage $R2 ${WM_SETFONT} $R9 0 

${NSD_CreateButton} 50u 82u 30 20 "OFF" 
Pop $button
; интерфейс страницы - в виде круга
System::Call "*(i, i, i, i)i.r0"
System::Call "User32::GetClientRect(i$HWNDPARENT, ir0)"
System::Call "*$0(i, i, i.r1, i.r2)"
IntOp $1 $1 + 5 
IntOp $2 $2 + 30 
System::Call "Gdi32::CreateRoundRectRgn(i0,i0,i200,i200,i200,i200)i.r0"
System::Call "User32::SetWindowRgn(i$HWNDPARENT, ir0, i1)"

  ; Font снежинки (цифры и буквы - форма снежинок)
  CreateFont $Font1 "Faux Snow BRK" 30
  ${NSD_CreateLabel} 50u 5u 20u 20u "0"
  Pop $Label3
  SendMessage $Label3 ${WM_SETFONT} $Font1 0
  SetCtlColors $Label3 0xFFFFFF 0x972FFF
  
  ${NSD_CreateLabel} 20u 78u 20u 20u "0"
  Pop $Label
  SendMessage $Label ${WM_SETFONT} $Font1 0
  SetCtlColors $Label 0xFFFFFF 0x972FFF
  
  ${NSD_CreateLabel} 80u 78u 20u 20u "0"
  Pop $Label2
  SendMessage $Label2 ${WM_SETFONT} $Font1 0
  SetCtlColors $Label2 0xFFFFFF 0x972FFF

${NSD_OnClick} $button done
${NSD_CreateTimer} OnTimer 1000
nsDialogs::Show
${NSD_KillTimer} OnTimer
FunctionEnd

Function OnTimer
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
${NSD_SetText} $R2 "$4 : $5 : $6"
FunctionEnd

Function done
SendMessage $hwndparent ${WM_CLOSE} 0 0
FunctionEnd

Section
SectionEnd
© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容