Calcolatrice semplice, Il mio primo programma

« Older   Newer »
  Share  
Crazy_Mauro
CAT_IMG Posted on 27/5/2008, 16:53     +1   -1




CODICE
#include <GUIConstants.au3>


$Form1 = GUICreate("Calcolatrice", 180, 230, 300, 127, $WS_EX_TRANSPARENT)
GUISetBkColor(0xC0C0C0)
$Input1 = GUICtrlCreateInput(" ", 7, 32, 161, 21)
$Button1 = GUICtrlCreateButton("1", 32, 72, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button2 = GUICtrlCreateButton("2", 64, 72, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button3 = GUICtrlCreateButton("3", 96, 72, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button4 = GUICtrlCreateButton("4", 32, 104, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button5 = GUICtrlCreateButton("5", 64, 104, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button6 = GUICtrlCreateButton("6", 96, 104, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button7 = GUICtrlCreateButton("7", 32, 136, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button8 = GUICtrlCreateButton("8", 64, 136, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button9 = GUICtrlCreateButton("9", 96, 136, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button10 = GUICtrlCreateButton("0", 32, 168, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button11 = GUICtrlCreateButton("00", 64, 168, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button12 = GUICtrlCreateButton("=", 96, 168, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button13 = GUICtrlCreateButton("+", 136, 168, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button14 = GUICtrlCreateButton("-", 136, 136, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button15 = GUICtrlCreateButton("*", 136, 104, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Button16 = GUICtrlCreateButton("/", 136, 72, 27, 25, 0)
GUICtrlSetColor(-1, 0x000000)
$Label1 = GUICtrlCreateLabel("Calcolatrice", 52, 8, 80, 19)
GUICtrlSetFont(-1, 10, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0x000000)
$Button17 = GUICtrlCreateButton("OFF", 147, 0, 27, 15, 0)
$Button18 = GUICtrlCreateButton("CE", 3, 168, 27, 25, 0)
GUISetState(@SW_SHOW)
While 1
  $nMsg = GUIGetMsg()
  Switch $nMsg
     Case $GUI_EVENT_CLOSE
        Exit
     case $Button17
        Exit
     case $Button18
        GUICtrlSetData($Input1,"")
     CASE $Button1
        $1= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$1 & "1")
     CASE $Button2
        $2= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$2 & "2")
     CASE $Button3
        $3= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$3 & "3" )
     CASE $Button4
        $4= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$4 & "4" )
     CASE $Button5
        $5= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$5 & "5")
     CASE $Button6
        $6= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$6 & "6" )
     CASE $Button7
        $7= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$7 & "7" )
     CASE $Button8
        $8= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$8 & "8" )
     CASE $Button9
        $9= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$9 & "9" )
     CASE $Button10
        $10= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$10 & "0" )
     CASE $Button11
        $11= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$11 & "00" )
     CASE $Button13
        $13= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$13 & "+" )
     CASE $Button14
        $14= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$14 & "-" )
     CASE $Button15
        $15= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$15 & "*" )
     CASE $Button16
        $16= GUICtrlRead($Input1)
        GUICtrlSetData($Input1,$16 & "/" )
        CASE $Button12
        $stringaz = GUICtrlRead($Input1)
        $risultato = Execute ($stringaz)
        guictrlsetdata($Input1,$risultato)

  EndSwitch
WEnd
 
Top
lknokl
CAT_IMG Posted on 27/5/2008, 17:02     +1   -1




Molto carina ^^ soprattutto perche e cosi piccolina ^^
 
Top
I.Ren
CAT_IMG Posted on 27/5/2008, 17:20     +1   -1




che figa! sopratutto il tasto off x chiudere! ottimo lavoro!
 
Top
Crazy_Mauro
CAT_IMG Posted on 27/5/2008, 17:37     +1   -1




CITAZIONE (lknokl @ 27/5/2008, 18:02)
Molto carina ^^ soprattutto perche e cosi piccolina ^^

CITAZIONE (I.Ren @ 27/5/2008, 18:20)
che figa! sopratutto il tasto off x chiudere! ottimo lavoro!

Grazie a tutti :)
 
Top
3 replies since 27/5/2008, 16:53   102 views
  Share