ألــــــــــة حــاسـبـة مـتـطـورة ( تـحـفـة )
هذه
الألة ليست من تصميمي ولكنني قمت بالتعديل عليها وتطويرها لتظهر
لحضراتكم
بهذا الشكل
قبل
وبعد
[/URL]
ندخل في الموضوع ها هو الكود البرمجي
[php]
Option Explicit
Dim operand1 As Double, operand2 As Double
Dim
operator As String
Dim cleardisplay As Boolean
Dim memory1 As
Double
Dim percent As Double
Private Sub
cmdClear_Click()
If Label2.Caption <> "Calculator" Then
MsgBox
"Click On The Calculator Button First!!"
End If
lblDisplay.Caption
= ""
End Sub
Private Sub cmdClearAll_Click()
If
Label2.Caption <> "Calculator" Then
MsgBox "Click On The
Calculator Button First!!"
End If
operand1 = 0
operand2 = 0
lblDisplay.Caption
= ""
lblRunning.Caption = ""
End Sub
Private Sub
cmdCos_Click()
lblDisplay.Caption = Cos(Val(lblDisplay.Caption))
End
Sub
Private Sub cmdDigits_Click(Index As Integer)
If
cleardisplay Then
lblDisplay.Caption = ""
cleardisplay =
False
End If
If Len(lblDisplay.Caption) < 10 Then
lblDisplay.Caption = lblDisplay.Caption + cmdDigits(Index).Caption
Else
End If
End Sub
Private Sub
cmdDivide_Click()
operand1 = Val(lblDisplay.Caption)
operator =
"/"
lblDisplay.Caption = ""
End Sub
Private Sub
cmdEquals_Click()
On Error GoTo errorhandler
Dim result As
Double
operand2 = Val(lblDisplay.Caption)
If operator = "+"
Then result = operand1 + operand2
If operator = "-" Then result =
operand1 - operand2
If operator = "*" Then result = operand1 *
operand2
If operator = "/" And operand2 <> "0" Then _
result = operand1 / operand2
lblDisplay.Caption = result
operand1
= result
lblRunning.Caption = result
Exit Sub
errorhandler:
MsgBox
"The operation resulted in the following error" & _
vbCrLf
& Err.Description
lblDisplay.Caption = "ERROR"
cleardisplay =
True
End Sub
Private Sub cmdMemory1_Click()
memory1 =
lblDisplay.Caption
lblMemory1 = memory1
End Sub
Private Sub
cmdMemory2_Click()
lblDisplay.Caption = memory1
End Sub
Private
Sub cmdMemory3_Click()
memory1 = 0
lblMemory1.Caption = ""
End
Sub
Private Sub cmdMinus_Click()
operand1 =
Val(lblDisplay.Caption)
operator = "-"
lblDisplay.Caption = ""
End
Sub
Private Sub cmdOver_Click()
If
Val(lblDisplay.Caption) <> 0 Then lblDisplay.Caption = _
1 / Val(lblDisplay.Caption)
End Sub
Private Sub cmdPlus_Click()
operand1 =
Val(lblDisplay.Caption)
operator = "+"
lblDisplay.Caption = ""
lblRunning.Caption
= operand1
End Sub
Private Sub cmdPlusMinus_Click()
lblDisplay.Caption
= -Val(lblDisplay.Caption)
End Sub
Private Sub
cmdSin_Click()
lblDisplay.Caption = Sin(Val(lblDisplay.Caption))
End
Sub
Private Sub cmdSquareRoot_Click()
If lblDisplay.Caption
< 0 Then
MsgBox "Can't calculate the square root of a negative
number"
Else
lblDisplay.Caption = Sqr(Val(lblDisplay.Caption))
End
If
End Sub
Private Sub cmdTimes_Click()
operand1 =
Val(lblDisplay.Caption)
operator = "*"
lblDisplay.Caption = ""
End
Sub
Private Sub Command1_Click()
If
InStr(lblDisplay.Caption, ".") Then
Exit Sub
Else
lblDisplay.Caption = lblDisplay.Caption + "."
End If
End Sub
Private
Sub Command2_Click()
Label1.Visible = False
Label3.Visible =
False
Label4.Visible = False
Label5.Visible = True
Label2.Caption
= "Clock"
Timer1.Enabled = True
End Sub
Private Sub
Command3_Click()
Label2.Caption = "Calculator"
Timer1.Enabled =
False
Label1.Visible = False
Label3.Visible = False
Label4.Visible
= False
Label5.Visible = False
cmdClearAll_Click
End Sub
Private
Sub Command4_Click()
Label2.Caption = "Date"
Timer1.Enabled =
False
Label1.Visible = True
Label3.Visible = True
Label4.Visible
= True
Label5.Visible = False
lblDisplay.Caption = " " &
Year(Now) & " " & Month(Now) & " " &
Day(Now)
End Sub
Private Sub Form_Load()
Label2.Caption =
"Calculator"
Skin1.ApplySkin hWnd
End Sub
Private Sub
Timer1_Timer()
lblDisplay.Caption = Format(Now, "hh:mm:ss AM/PM")
End
Sub
[/php]
^^
^^
^^
^^
ولتحميل المشروع
جاهز
http://www.mediafire.com/?kyoyzfbzj1m