CODICE
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <Misc.au3>
#include <Timers.au3>
#include <FileConstants.au3>
_GDIPlus_Startup()
$MouseBut = IniRead("Settings.ini","Settings","ButtonGo","01")
$StartBut = IniRead("Settings.ini","Settings","ButtonGo","2C")
$ColorBut = IniRead("Settings.ini","Settings","ButtonColor", "43")
$SaveBut = IniRead("Settings.ini","Settings","SaveBut", "53")
$EvBut = IniRead("Settings.ini","Settings","SaveBut", "45")
$HelpBut = IniRead("Settings.ini","Settings","HelpB", "48")
$NPDel = 150
global $Timer = 0
dim $OldP[2]
global $Color ="0xFFFF0000"
global $Size = 5
$n = 1
Opt( "TrayMenuMode" ,1)
if FileExists(@ScriptDir&"\LavagnaAperta.Ref") Then
MsgBox(48,"Errore","Hai gia aperto un'altra lavagna, non puoi aprirne due insieme."&@cr&@cr&"Se invece non ne hai aperta nessuna allora vi č stato un'errore nell'eliminazione del file che controlla il doppio eseguimento."&@cr&" ELIMINA QUESTO FILE PER RISOLVERE: "&@CR&@ScriptDir&"\LavagnaAperta.Ref")
exit
EndIf
FileWrite(@ScriptDir&"\LavagnaAperta.Ref","Yes")
Standby()
Func GuiPaint()
$Timer = _Timer_Init()
$hBitmap1 = _ScreenCapture_Capture("",-1,-1,-1,-1,false)
$FormP = GUICreate("", @DesktopWidth,@DesktopHeight,0,0,$WS_POPUP)
GUISetState(@SW_SHOW)
global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($FormP)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)
_GDIPlus_GraphicsDrawImage($hGraphic, $hImage2, 0, 0)
While 1
;help
if _IsPressed($HelpBut) Then
HelpGui()
EndIf
;evidencier
if _IsPressed($EvBut) Then
While _IsPressed($EvBut)
WEnd
if StringInStr($color,"0x50") = 0 then
$Color = StringReplace( $Color ,"0xFF","0x50")
Else
$Color = StringReplace( $Color ,"0x50","0xFF")
EndIf
EndIf
;chose color
if _IsPressed($ColorBut) THEN
$col=_ChooseColor(2)
if StringInStr($color,"0x50") = 0 then
$Color = "0xFF"&StringReplace($col,"0x","")
Else
$Color = "0x50"&StringReplace($col,"0x","")
EndIf
EndIf
;eixt but
if _IsPressed("1B") THEN
While _IsPressed("1B")
WEnd
$Timer = 0
_GDIPlus_GraphicsDispose ( $hGraphic )
GUIDelete($FormP)
Standby()
EndIf
;;click left = PAINT
if _IsPressed($MouseBut) Then
$M=MouseGetPos()
Write($M,$Size,$Color,$Timer) ;PAINT FUNC
EndIf
;;save img
if _IsPressed($SaveBut) Then
$file =FileSaveDialog("Salva...",@desktopdir,"BMP(*.bmp)")
if not @error Then
if StringInStr($file,".bmp") = 0 then $file &= ".bmp"
_ScreenCapture_Capture($file,-1,-1,-1,-1,false)
EndIf
EndIf
;;resize 1 to 9
$n+=1
if $n > 39 Then $n = 30
if _IsPressed($n) Then
$Size = StringRight($n,1)
if $Size = 0 and $n <> 33 then
$Size = 20
Else
$Size *= 2
EndIf
ToolTip($Size&"px")
Sleep(20)
ToolTip("")
EndIf
WEnd
EndFunc
func Write($Pos,$Size,$color,$Time)
if _Timer_Diff($Time) > $NPDel Then
$OldP = $Pos
EndIf
$Timer = _Timer_Init()
if StringInStr($color,"0x50") = 0 then
$hBrush1 = _GDIPlus_BrushCreateSolid()
_GDIPlus_BrushSetSolidColor($hBrush1, $color)
_GDIPlus_GraphicsFillEllipse($hGraphic, $Pos[0]-$Size/2,$Pos[1]-$Size/2,$Size,$Size,$hBrush1)
EndIf
$Pen=_GDIPlus_PenCreate($color,$Size)
_GDIPlus_GraphicsDrawLine ( $hGraphic , $OldP[0], $OldP[1], $Pos[0], $Pos[1],$Pen )
$OldP = $Pos
EndFunc
func HelpGui()
$Form1 = GUICreate("HELP", 362, 380)
GUISetBkColor(0xFFFFFF)
$Label1 = GUICtrlCreateLabel("Creato da: KingPaic Il:12/10/2014", 152, 8, 197, 17)
$Pulsanti = GUICtrlCreateGroup("Pulsanti", 8, 32, 345, 310)
$Label2 = GUICtrlCreateLabel("[Stamp] = Avvio lavagna con schermo corrente", 18, 60, 330, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("[C] = Selezione colori", 18, 90, 151, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("[S] = Salva immagine corrente (.bmp)", 18, 120, 263, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("[H] = Accedere all'Help", 18, 150, 164, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("[ESC] = Lavagna->Standby Standby->Uscita", 18, 180, 326, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("[E] = Modalitą evidenziatore ON/OFF", 18, 210, 261, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label8 = GUICtrlCreateLabel("[1-2-3-4-5-6-7-8-9-0] = Grandezza tratto ", 18, 270, 289, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("TORNA", 128, 350, 99, 25)
GUISetState(@SW_SHOW)
$hGraphic2 = _GDIPlus_GraphicsCreateFromHWND($Form1)
$Pen=_GDIPlus_PenCreate(0xFFFF0000,8)
_GDIPlus_GraphicsDrawLine ( $hGraphic2 , 40, 250, 150, 250 ,$Pen )
$Pen=_GDIPlus_PenCreate(0x50FF0000,8)
_GDIPlus_GraphicsDrawLine ( $hGraphic2 , 200, 250, 310, 250 ,$Pen )
$n = 10
for $i=1 to $n step 1
$hBrush12 = _GDIPlus_BrushCreateSolid()
_GDIPlus_BrushSetSolidColor($hBrush12, $color)
_GDIPlus_GraphicsFillEllipse($hGraphic2,(362*($i/$n )),320-$i, $i*2, $i*2,$hBrush12)
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_GDIPlus_GraphicsDispose ( $hGraphic2)
GUIDelete($Form1)
ExitLoop
Case $Button1
_GDIPlus_GraphicsDispose ( $hGraphic2)
GUIDelete($Form1)
ExitLoop
EndSwitch
WEnd
EndFunc
Func Standby()
While 1
; stamp
if _IsPressed ($StartBut) THEN
while _IsPressed ($StartBut)
WEnd
GuiPaint()
EndIf
;exit all
if _IsPressed("1B") THEN
$q=MsgBox(4,"KingPaic Screen Painter (Exit)","Sei sicuro di voler uscire dalla lavagna?"&@cr&@cr&"Cosi facendo il tasto Stamp non ti permetterą di disegnare, almeno finchč non riaprirai il programma.")
if $q = 6 Then
FileDelete(@ScriptDir&"\LavagnaAperta.Ref")
Exit
EndIf
EndIf
Sleep(25)
WEnd
EndFunc