VERSION 5.00 Begin VB.Form Form1 Caption = "Teorema di Pitagora" ClientHeight = 3375 ClientLeft = 165 ClientTop = 735 ClientWidth = 4920 LinkTopic = "Form1" ScaleHeight = 3375 ScaleWidth = 4920 StartUpPosition = 3 'Windows Default Begin VB.CommandButton Command3 Caption = "Cancella" Height = 495 Left = 1560 TabIndex = 9 Top = 2160 Width = 1695 End Begin VB.PictureBox Picture1 Height = 1500 Left = 1560 ScaleHeight = 1440 ScaleWidth = 1440 TabIndex = 8 Top = 0 Width = 1500 End Begin VB.CommandButton Command2 Caption = "&Fine" Height = 495 Left = 1560 TabIndex = 7 ToolTipText = "Esce dal programma" Top = 2760 Width = 1695 End Begin VB.CommandButton Command1 Caption = "&Calcola" Height = 495 Left = 1560 TabIndex = 6 ToolTipText = "Calcola l'incognita scelta" Top = 1560 Width = 1695 End Begin VB.TextBox Text3 Alignment = 1 'Right Justify BackColor = &H80000004& Height = 375 Left = 120 Locked = -1 'True TabIndex = 4 Top = 2640 Width = 1215 End Begin VB.TextBox Text2 Alignment = 1 'Right Justify Height = 375 Left = 120 TabIndex = 1 Top = 1800 Width = 1215 End Begin VB.TextBox Text1 Alignment = 1 'Right Justify Height = 375 Left = 120 TabIndex = 0 ToolTipText = "Hai scelto l'incognita?" Top = 960 Width = 1215 End Begin VB.Label Label3 Height = 375 Left = 120 TabIndex = 5 Top = 2280 Width = 1215 End Begin VB.Label Label2 Height = 375 Left = 120 TabIndex = 3 Top = 1440 Width = 1215 End Begin VB.Label Label1 Height = 375 Left = 120 TabIndex = 2 Top = 600 Width = 1215 End Begin VB.Menu Scelta Caption = "Scegli l'incognita" Begin VB.Menu Ipotenusa Caption = "Ipotenusa" Index = 2 End Begin VB.Menu Cateto Caption = "Cateto" Index = 1 End End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Cateto_Click(Index As Integer) 'Text1.Text = "" 'Text2.Text = "" 'Text3.Text = "" Label1.Caption = "Ipotenusa" Label2.Caption = "Cateto1" Label3.Caption = "Cateto2" Command1.Enabled = True Text1.SetFocus End Sub Private Sub Command1_Click() If Label1.Caption = "Cateto1" Then c1 = Val(Text1.Text) c2 = Val(Text2.Text) If c1 <= 0 Or c2 <= 0 Then MsgBox "I cateti devono avere lunghezza > di zero! Reinserisci il valore dei cateti.", vbCritical, "Errore" Else i = Sqr(c1 ^ 2 + c2 ^ 2) Text3.Text = i Picture1.Line (200, 1300)-(1300, 1300) Picture1.Line (200, 200)-(200, 1300) Picture1.Line (200, 200)-(1300, 1300), vbRed End If End If If Label1.Caption = "Ipotenusa" Then i = Val(Text1.Text) c1 = Val(Text2.Text) If c1 >= i Then msg = "l'ipotenusa deve essere > del cateto" MsgBox msg, 16, "Errore" 'Text1.Text = "" 'Text2.Text = "" Text1.SetFocus Else c2 = Sqr(i ^ 2 - c1 ^ 2) Text3.Text = c2 Picture1.Line (200, 1300)-(1300, 1300) Picture1.Line (200, 200)-(200, 1300), vbRed Picture1.Line (200, 200)-(1300, 1300) End If End If End Sub Private Sub Command2_Click() End End Sub Private Sub Command3_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" End Sub Private Sub Form_Load() Command1.Enabled = False End Sub Private Sub Ipotenusa_Click(Index As Integer) 'Text1.Text = "" 'Text2.Text = "" 'Text3.Text = "" Label1.Caption = "Cateto1" Label2.Caption = "Cateto2" Label3.Caption = "Ipotenusa" Command1.Enabled = True Text1.SetFocus End Sub Private Sub Text1_gotfocus() Text1.SelStart = 0 Text1.SelLength = 1000 End Sub Private Sub Text2_gotfocus() Text2.SelStart = 0 Text2.SelLength = 1000 End Sub