Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Crea Triangolo - triangolo.frm

triangolo.frm

Caricato da: Antometal
Scarica il programma completo

  1. Private Sub Cmdline_Click()
  2. CDialog.ShowColor
  3.     For i = 0 To 3
  4.         ln(i).BorderColor = CDialog.Color
  5.     Next i
  6. End Sub
  7.  
  8. Private Sub Cmdsfondo_Click()
  9. CDialog.ShowColor
  10. Me.BackColor = CDialog.Color
  11. End Sub
  12.  
  13. Private Sub Form_DblClick()
  14. Form_Load
  15. Me.Refresh
  16. End Sub
  17.  
  18. Private Sub Form_Load()
  19. Me.Caption = "Disegna un triangolo"
  20. b.Visible = True
  21. h.Visible = True
  22. Label1.Visible = True
  23. Label2.Visible = True
  24. ok.Visible = True
  25. Cmdsfondo.Visible = False
  26. Cmdline.Visible = False
  27. spess.Visible = False
  28.     For i = 0 To 19
  29.         spess.AddItem i + 1
  30.             If i < 4 Then ln(i).Visible = False
  31.     Next i
  32. End Sub
  33.  
  34. Private Sub ok_Click()
  35.     If IsNumeric(b.Text) = False Then GoTo nob
  36.     If IsNumeric(h.Text) = False Then GoTo noh
  37. b = b.Text
  38. h = h.Text
  39.     If b <= 0 Or b > Me.Width Then GoTo tb
  40.     If h <= 0 Or h > Me.Height Then GoTo th
  41. b.Visible = False
  42. h.Visible = False
  43. Label1.Visible = False
  44. Label2.Visible = False
  45. ok.Visible = False
  46. Cmdsfondo.Visible = True
  47. Cmdline.Visible = True
  48. spess.Visible = True
  49. 'coordinate degli angoli del triangolo
  50. xb1 = (Me.Width - b) / 2
  51. xb2 = xb1 + b
  52. xh = Me.Width / 2
  53. yh1 = (Me.Height - h) / 2
  54. yh2 = yh1 + h
  55. Me.DrawWidth = 2
  56. 'altezza
  57. ln(0).X1 = xh
  58. ln(0).Y1 = yh1
  59. ln(0).X2 = xh
  60. ln(0).Y2 = yh2
  61. 'base
  62. ln(1).X1 = xb1
  63. ln(1).Y1 = yh2
  64. ln(1).X2 = xb2
  65. ln(1).Y2 = yh2
  66. 'lati
  67. ln(2).X1 = xh
  68. ln(2).Y1 = yh1
  69. ln(2).X2 = xb2
  70. ln(2).Y2 = yh2
  71. ln(3).X1 = xb1
  72. ln(3).Y1 = yh2
  73. ln(3).X2 = xh
  74. ln(3).Y2 = yh1
  75.     For i = 0 To 3
  76.         ln(i).Visible = True
  77.     Next i
  78. Me.Caption = "DblCclick per disegnare un altro triangolo"
  79.  
  80. Exit Sub
  81. nob:
  82. MsgBox "Inserisci valore numerico", vbCritical, "Tipo non corrispondente"
  83. b.Text = ""
  84. Exit Sub
  85. noh:
  86. MsgBox "Inserisci valore numerico", vbCritical, "Tipo non corrispondente"
  87. h.Text = ""
  88. Exit Sub
  89. tb:
  90. MsgBox "Inserisci un nuemro > di 0 e < o = a " & Me.Width & Chr(13) & Chr(10) & "Puoi anche ingrandire la finestra", vbCritical, "Errore"
  91. b.Text = ""
  92. Exit Sub
  93. th:
  94. MsgBox "Inserisci un nuemro > di 0 e < o = a " & Me.Height & Chr(13) & Chr(10) & "Puoi anche ingrandire la finestra", vbCritical, "Errore"
  95. h.Text = ""
  96. End Sub
  97.  
  98. Private Sub spess_Click()
  99.     For i = 0 To 3
  100.         ln(i).BorderWidth = spess.Text
  101.     Next i
  102. End Sub