bonjour, cette fois-ci, je vais vous apprendre comment créer un bloc note.
Suivez Bien Les étape Suivants :
1) Ouvrir Microsoft Visual Basic 2008
2) Créer un nouveau document ( ctrl + n ), application windows form et, on donne le nom qu'on veut : Bloc Note ( exemple ).
3) On ajoute une RichTextBox et un MenuStrip à notre form.
4) On ajoute dans le menustrip :
Fichier, Édition, Format.
et dans fichier : Ouvrir, Enregistrer, Quitter
Édition: Copier, Coller, Couper, Tout supprimer
Format : Police , Couleur
5) Lorsque ça a été fait, il suffit maintenant de rajouter les codes dans le bon emplacement :
| Code: |
Sur le bouton Tout éffacer : RichTextBox1.Clear() Ouvrir Try Dim dlg As OpenFileDialog = New OpenFileDialog dlg.Title = "Ouvrir" dlg.Filter = "Rich Text Files (*.rtf)|*.rtf" If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then RichTextBox1.LoadFile(dlg.FileName) End If Catch ex As Exception : End Try Enregistrer Try Dim dlg As SaveFileDialog = New SaveFileDialog dlg.Title = "Enregistré" dlg.Filter = "Rich Text Files (*.rtf)|*.rtf" If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then RichTextBox1.SaveFile(dlg.FileName, RichTextBoxStreamType.RichText) End If Catch ex As Exception : End Try Couper RichTextBox1.Cut() Copier RichTextBox1.Copy() Coller RichTextBox1.Paste() Selectionner tout RichTextBox1.SelectAll() Police Try Dim dlg As FontDialog = New FontDialog dlg.Font = RichTextBox1.Font If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then RichTextBox1.Font = dlg.Font End If Catch ex As Exception : End Try Couleur Try Dim dlg As ColorDialog = New ColorDialog dlg.Color = RichTextBox1.ForeColor If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then RichTextBox1.ForeColor = dlg.Color End If Catch ex As Exception : End Try
|