Questo sito utilizza cookies, anche di terze parti, per mostrare pubblicità e servizi in linea con il tuo account. Leggi l'informativa sui cookies.
Username: Password: oppure
Edit text - Frmedit.vb

Frmedit.vb

Caricato da: Albertking82
Scarica il programma completo

  1. Public Class Frmedit
  2.     Dim flag As Boolean
  3.     Dim risposta As Integer
  4.     Private Sub ApriToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ApriToolStripMenuItem.Click
  5.         Dim f As Integer
  6.         f = FreeFile()
  7.         With Open
  8.             .Filter = "Rtf|*.rtf"
  9.             .FileName = ""
  10.             .Title = "Apri RTF"
  11.             .ShowDialog()
  12.         End With
  13.         If Open.FileName <> "" Then
  14.             rtxt.LoadFile(Open.FileName, RichTextBoxStreamType.RichText)
  15.         End If
  16.  
  17.     End Sub
  18.  
  19.     Private Sub EsciToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EsciToolStripMenuItem.Click
  20.  
  21.         risposta = MsgBox("Sei sicuro di voler uscire?", MsgBoxStyle.YesNoCancel, "Esci?")
  22.  
  23.         If risposta = vbYes Then
  24.             End
  25.         Else
  26.             Exit Sub
  27.         End If
  28.     End Sub
  29.  
  30.     Private Sub SalvaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  31.         With Save
  32.             .Title = "Salva RTF"
  33.             .FileName = "Nomefile"
  34.             .Filter = "RTF|*.rtf"
  35.             .ShowDialog()
  36.             rtxt.SaveFile(Save.FileName, RichTextBoxStreamType.RichText)
  37.             flag = True
  38.         End With
  39.     End Sub
  40.  
  41.     Private Sub CarattereToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CarattereToolStripMenuItem1.Click
  42.         With fd
  43.             .ShowColor = True
  44.             .ShowDialog()
  45.         End With
  46.         rtxt.SelectionFont = fd.Font
  47.     End Sub
  48.     Private Sub ColoreToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColoreToolStripMenuItem1.Click
  49.         cd.ShowDialog()
  50.         rtxt.SelectionColor = cd.Color
  51.         rtxt.ForeColor = Color.Black
  52.     End Sub
  53.  
  54.     Private Sub CancellaTuttoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancellaTuttoToolStripMenuItem.Click
  55.         rtxt.Text = ""
  56.     End Sub
  57.  
  58.     Private Sub CancellaSelezioneToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancellaSelezioneToolStripMenuItem.Click
  59.         rtxt.SelectedText = ""
  60.     End Sub
  61.  
  62.     Private Sub Frmedit_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  63.  
  64.         If Not flag Then
  65.             risposta = MsgBox("Vuoi salvare prima di uscire?", MsgBoxStyle.YesNoCancel, "Salva?")
  66.             If risposta = vbYes Then
  67.                 With Save
  68.                     .Title = "Salva RTF"
  69.                     .FileName = "Nomefile"
  70.                     .Filter = "RTF|*.rtf"
  71.                     .ShowDialog()
  72.                     rtxt.SaveFile(Save.FileName, RichTextBoxStreamType.RichText)
  73.                     flag = True
  74.                 End With
  75.                 End
  76.             Else
  77.                 End
  78.             End If
  79.         End If
  80.     End Sub
  81.  
  82.     Private Sub Frmedit_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  83.         flag = False
  84.     End Sub
  85.  
  86.     Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
  87.         Frmabout.Show()
  88.     End Sub
  89. End Class