une petite bloc-note qui contient tout les option nécessaire d'un bloc-note est qui peut colorier les code en langage Visual basic
Source / Exemple :
Public Class Form1
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Form2_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
End Sub
Private Sub ToolStripMenuItem10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem10.Click
RichTextBox1.Cut()
End Sub
Private Sub ToolStripMenuItem11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem11.Click
RichTextBox1.Copy()
End Sub
Private Sub ToolStripMenuItem12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem12.Click
RichTextBox1.Paste()
End Sub
Private Sub ENMAJUSCULEToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ENMAJUSCULEToolStripMenuItem.Click
RichTextBox1.SelectedText = UCase(RichTextBox1.SelectedText)
End Sub
Private Sub EnminusculeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EnminusculeToolStripMenuItem.Click
RichTextBox1.SelectedText = LCase(RichTextBox1.SelectedText)
End Sub
Private Sub SélectionnerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SélectionnerToolStripMenuItem.Click
RichTextBox1.SelectedText = ""
End Sub
Private Sub ToolStripMenuItem13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem13.Click
RichTextBox1.SelectAll()
End Sub
Private Sub ToolStripMenuItem16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem16.Click
If RichTextBox1.Text <> "" Then
Dim x As MsgBoxResult = MsgBox("Vouler vous effacer tout", MsgBoxStyle.YesNoCancel)
If x = MsgBoxResult.Yes Then
RichTextBox1.Clear()
End If
End If
End Sub
Private Sub ToolStripMenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem7.Click
If Label3.Text = "a" Then
Dim x As MsgBoxResult = MsgBox("Voulez vous enregistrer les modifications", MsgBoxStyle.YesNoCancel + MsgBoxStyle.Exclamation)
If x = MsgBoxResult.No Then
Label2.Text = "b"
RichTextBox1.Clear()
ElseIf x = MsgBoxResult.Yes Then
Try
If Label1.Text <> "" Then
If Dir(Label1.Text$, vbNormal) <> "" Then
RichTextBox1.SaveFile(Label1.Text, RichTextBoxStreamType.RichText)
Label2.Text = "b"
RichTextBox1.Clear()
End If
Else
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
If dlg.FileName.EndsWith(".rtf") Then
RichTextBox1.SaveFile(dlg.FileName, RichTextBoxStreamType.RichText)
Label1.Text = dlg.FileName
Label2.Text = "a"
Label3.Text = "b"
RichTextBox1.Clear()
End If
End If
Catch ex As Exception : End Try
End If
Catch ex As Exception : End Try
End If
Else
Label2.Text = "b"
RichTextBox1.Clear()
End If
Me.Close()
End Sub
Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
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
If dlg.FileName.EndsWith(".rtf") Then
RichTextBox1.SaveFile(dlg.FileName, RichTextBoxStreamType.RichText)
Label1.Text = dlg.FileName
Label2.Text = "a"
Label3.Text = "b"
End If
End If
Catch ex As Exception : End Try
End Sub
Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
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
If dlg.FileName.EndsWith(".rtf") Then
RichTextBox1.LoadFile(dlg.FileName)
Label1.Text = dlg.FileName
Label2.Text = "a"
Label3.Text = "b"
End If
End If
Catch ex As Exception : End Try
End Sub
Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
If Label2.Text = "a" Then
Try
If Label1.Text <> "" Then
If Dir(Label1.Text$, vbNormal) <> "" Then
RichTextBox1.SaveFile(Label1.Text, RichTextBoxStreamType.RichText)
Label3.Text = "b"
End If
End If
Catch ex As Exception : End Try
Else
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
If dlg.FileName.EndsWith(".rtf") Then
RichTextBox1.SaveFile(dlg.FileName, RichTextBoxStreamType.RichText)
Label1.Text = dlg.FileName
Label2.Text = "a"
Label3.Text = "b"
End If
End If
Catch ex As Exception : End Try
End If
End Sub
Private Sub FermerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FermerToolStripMenuItem.Click
If Label3.Text = "a" Then
If Label2.Text = "a" Then
Dim x As MsgBoxResult = MsgBox("Voulez vous enregistrer les modifications", MsgBoxStyle.YesNoCancel + MsgBoxStyle.Exclamation)
If x = MsgBoxResult.No Then
Label2.Text = "b"
RichTextBox1.Clear()
Label1.Text = ""
ElseIf x = MsgBoxResult.Yes Then
Try
If Label1.Text <> "" Then
If Dir(Label1.Text$, vbNormal) <> "" Then
RichTextBox1.SaveFile(Label1.Text, RichTextBoxStreamType.RichText)
Label2.Text = "b"
RichTextBox1.Clear()
Label1.Text = ""
End If
End If
Catch ex As Exception : End Try
End If
End If
Else
Label2.Text = "b"
Label1.Text = ""
End If
End Sub
Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
Label3.Text = "a"
End Sub
Private Sub ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem1.Click
If Label3.Text = "a" Then
Dim x As MsgBoxResult = MsgBox("Voulez vous enregistrer les modifications", MsgBoxStyle.YesNoCancel + MsgBoxStyle.Exclamation)
If x = MsgBoxResult.No Then
Label2.Text = "b"
RichTextBox1.Clear()
ElseIf x = MsgBoxResult.Yes Then
Try
If Label1.Text <> "" Then
If Dir(Label1.Text$, vbNormal) <> "" Then
RichTextBox1.SaveFile(Label1.Text, RichTextBoxStreamType.RichText)
Label2.Text = "b"
RichTextBox1.Clear()
End If
End If
Catch ex As Exception : End Try
End If
Else
Label2.Text = "b"
RichTextBox1.Clear()
End If
End Sub
Private Sub ÀproposdeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ÀproposdeToolStripMenuItem.Click
MsgBox("Blocnote - hm : Simple blocnote" & vbCrLf & vbCrLf & "Créer le 20/09/2011, par Hassen Major " & vbCrLf, MsgBoxStyle.Information, "A propos de...")
End Sub
Private Sub CouleurTexteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CouleurTexteToolStripMenuItem.Click
RichTextBox1.SelectionColor = Color.Brown
End Sub
Private Sub CouleurCommentToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CouleurCommentToolStripMenuItem.Click
RichTextBox1.SelectionColor = Color.Green
End Sub
Private Sub CouleurInstrToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CouleurInstrToolStripMenuItem.Click
RichTextBox1.SelectionColor = Color.Blue
End Sub
Private Sub CouleurTypeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CouleurTypeToolStripMenuItem.Click
RichTextBox1.SelectionColor = TextBox1.ForeColor
End Sub
Private Sub CouleurBlackToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CouleurBlackToolStripMenuItem.Click
RichTextBox1.SelectionColor = Color.Black
End Sub
Private Sub Vb2008ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Vb2008ToolStripMenuItem.Click
RichTextBox1.SelectionFont = TextBox2.Font
End Sub
Private Sub Vb2010ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Vb2010ToolStripMenuItem.Click
RichTextBox1.SelectionFont = TextBox1.Font
End Sub
Private Sub AnnulerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnnulerToolStripMenuItem.Click
RichTextBox1.Undo()
End Sub
Private Sub EtablirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EtablirToolStripMenuItem.Click
RichTextBox1.Redo()
End Sub
Private Sub PoliceToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PoliceToolStripMenuItem.Click
Try
Dim dlg As FontDialog = New FontDialog
dlg.Font = RichTextBox1.SelectionFont
If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then
RichTextBox1.SelectionFont = dlg.Font
End If
Catch ex As Exception : End Try
End Sub
Private Sub ToolStripMenuItem5_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
Try
Dim dlg As ColorDialog = New ColorDialog
dlg.Color = RichTextBox1.SelectionBackColor
If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then
RichTextBox1.SelectionBackColor = dlg.Color
End If
Catch ex As Exception : End Try
End Sub
Private Sub CoulerToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CoulerToolStripMenuItem.Click
Try
Dim dlg As ColorDialog = New ColorDialog
dlg.Color = RichTextBox1.SelectionColor
If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then
RichTextBox1.SelectionColor = dlg.Color
End If
Catch ex As Exception : End Try
End Sub
Private Sub DroiteToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DroiteToolStripMenuItem.Click
RichTextBox1.SelectionAlignment = HorizontalAlignment.Right
End Sub
Private Sub CentreToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CentreToolStripMenuItem.Click
RichTextBox1.SelectionAlignment = HorizontalAlignment.Center
End Sub
Private Sub GaucheToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GaucheToolStripMenuItem.Click
RichTextBox1.SelectionAlignment = HorizontalAlignment.Left
End Sub
Private Sub ToolStripMenuItem15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem15.Click
Dialog1.ShowDialog()
End Sub
End Class
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.