VERSION 5.00 Begin VB.Form Form1 AutoRedraw = -1 'True Caption = "Calculator" ClientHeight = 870 ClientLeft = 60 ClientTop = 345 ClientWidth = 2415 LinkTopic = "Form1" ScaleHeight = 870 ScaleWidth = 2415 StartUpPosition = 2 'CenterScreen Begin VB.TextBox Text2 Height = 285 Left = 0 TabIndex = 21 Top = 840 Visible = 0 'False Width = 2415 End Begin VB.CommandButton Command20 Caption = "=" Height = 255 Left = 2160 TabIndex = 20 Top = 600 Width = 255 End Begin VB.CommandButton Command19 Caption = "+" Height = 255 Left = 1920 TabIndex = 19 Top = 600 Width = 255 End Begin VB.CommandButton Command18 Caption = "-" Height = 255 Left = 1680 TabIndex = 18 Top = 600 Width = 255 End Begin VB.CommandButton Command17 Caption = "*" Height = 255 Left = 1440 TabIndex = 17 Top = 600 Width = 255 End Begin VB.CommandButton Command16 Caption = "/" Height = 255 Left = 1200 TabIndex = 16 Top = 600 Width = 255 End Begin VB.CommandButton Command15 Caption = "," Height = 255 Left = 960 TabIndex = 15 Top = 600 Width = 255 End Begin VB.CommandButton Command14 Caption = "-+" Height = 255 Left = 720 TabIndex = 14 Top = 600 Width = 255 End Begin VB.CommandButton Command13 Caption = "M" Height = 255 Left = 480 TabIndex = 13 Top = 600 Width = 255 End Begin VB.CommandButton Command12 Caption = "b" Height = 255 Left = 240 TabIndex = 12 Top = 600 Width = 255 End Begin VB.CommandButton Command11 Caption = "c" Height = 255 Left = 0 TabIndex = 11 Top = 600 Width = 255 End Begin VB.TextBox Text1 Alignment = 1 'Right Justify Height = 285 Left = 0 Locked = -1 'True MaxLength = 25 TabIndex = 10 Text = "0" Top = 0 Width = 2415 End Begin VB.CommandButton Command10 Caption = "0" Height = 255 Left = 2160 TabIndex = 9 Top = 360 Width = 255 End Begin VB.CommandButton Command9 Caption = "9" Height = 255 Left = 1920 TabIndex = 8 Top = 360 Width = 255 End Begin VB.CommandButton Command8 Caption = "8" Height = 255 Left = 1680 TabIndex = 7 Top = 360 Width = 255 End Begin VB.CommandButton Command7 Caption = "7" Height = 255 Left = 1440 TabIndex = 6 Top = 360 Width = 255 End Begin VB.CommandButton Command6 Caption = "6" Height = 255 Left = 1200 TabIndex = 5 Top = 360 Width = 255 End Begin VB.CommandButton Command5 Caption = "5" Height = 255 Left = 960 TabIndex = 4 Top = 360 Width = 255 End Begin VB.CommandButton Command4 Caption = "4" Height = 255 Left = 720 TabIndex = 3 Top = 360 Width = 255 End Begin VB.CommandButton Command3 Caption = "3" Height = 255 Left = 480 TabIndex = 2 Top = 360 Width = 255 End Begin VB.CommandButton Command2 Caption = "2" Height = 255 Left = 240 TabIndex = 1 Top = 360 Width = 255 End Begin VB.CommandButton Command1 Caption = "1" Height = 255 Left = 0 TabIndex = 0 Top = 360 Width = 255 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Dim a As Double, b As Double, z As String Private Sub Command1_Click() If Text1.Text = "0" Or Text1.Text = z Then Text1.Text = "1" Else Text1.Text = Text1.Text & "1" End If End Sub Private Sub Command11_Click() a = 0 b = 0 z = "" Form1.Height = 1275 Text2.Visible = False Text2.Text = "0" Text1.Text = "0" End Sub Private Sub Command12_Click() If Text1.Text = "0" Or Text1.Text = "1" Or Text1.Text = "2" Or Text1.Text = "3" Or Text1.Text = "4" Or Text1.Text = "5" Or Text1.Text = "6" Or Text1.Text = "7" Or Text1.Text = "8" Or Text1.Text = "9" Or Text1.Text = z Then Text1.Text = "0" Exit Sub End If Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1) End Sub Private Sub Command13_Click() a = Val(Text2.Text) 'Clipboard.SetText = a MsgBox "Ваш ответ скопирован в буфер обмена!", vbExclamation, "Сообщение" End Sub Private Sub Command14_Click() If Left(Text1.Text, 1) = "-" Then Text1.Text = Right(Text1.Text, Len(Text1.Text) - 1) Else Text1.Text = "-" & Text1.Text End If End Sub Private Sub Command15_Click() If Text1.Text = "0" Then Text1.Text = "0." Else Text1.Text = Text1.Text & "." End If End Sub Private Sub Command16_Click() a = Val(Text1.Text) z = "/" Text1.Text = z End Sub Private Sub Command17_Click() a = Val(Text1.Text) z = "*" Text1.Text = z End Sub Private Sub Command18_Click() a = Val(Text1.Text) z = "-" Text1.Text = z End Sub Private Sub Command19_Click() a = Val(Text1.Text) z = "+" Text1.Text = z End Sub Private Sub Command2_Click() If Text1.Text = "0" Or Text1.Text = z Then Text1.Text = "2" Else Text1.Text = Text1.Text & "2" End If End Sub Private Sub Command20_Click() b = Val(Text1.Text) Form1.Height = 1545 Text2.Visible = True Text1.Text = a & z & b & "=" If z = "+" Then Text2.Text = Str(a + b) If z = "-" Then Text2.Text = Str(a - b) If z = "*" Then Text2.Text = Str(a * b) If z = "/" Then If b = 0 Then MsgBox "На ноль делить нельзя!", vbCritical, "Ошибка в вычислении" Exit Sub End If Text2.Text = Str(a / b) End If End Sub Private Sub Command3_Click() If Text1.Text = "0" Or Text1.Text = z Then Text1.Text = "3" Else Text1.Text = Text1.Text & "3" End If End Sub Private Sub Command4_Click() If Text1.Text = "0" Or Text1.Text = z Then Text1.Text = "4" Else Text1.Text = Text1.Text & "4" End If End Sub Private Sub Command5_Click() If Text1.Text = "0" Or Text1.Text = z Then Text1.Text = "5" Else Text1.Text = Text1.Text & "5" End If End Sub Private Sub Command6_Click() If Text1.Text = "0" Or Text1.Text = z Then Text1.Text = "6" Else Text1.Text = Text1.Text & "6" End If End Sub Private Sub Command7_Click() If Text1.Text = "0" Or Text1.Text = z Then Text1.Text = "7" Else Text1.Text = Text1.Text & "7" End If End Sub Private Sub Command8_Click() If Text1.Text = "0" Or Text1.Text = z Then Text1.Text = "8" Else Text1.Text = Text1.Text & "8" End If End Sub Private Sub Command9_Click() If Text1.Text = "0" Or Text1.Text = z Then Text1.Text = "9" Else Text1.Text = Text1.Text & "9" End If End Sub Private Sub Command10_Click() If Text1.Text = "0" Or Text1.Text = z Then Text1.Text = "0" Else Text1.Text = Text1.Text & "0" End If End Sub Private Sub Form_Load() a = 0 b = 0 z = "" Form1.Height = 1275 Text2.Visible = False Text2.Text = "0" Text1.Text = "0" End Sub Private Sub Text1_DblClick() a = 0 b = 0 z = "" Form1.Height = 1275 Text2.Visible = False Text2.Text = "0" Text1.Text = "0" End Sub