Ecrire le code VB qui permet de réaliser l'interface suivante:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
Public Class Form1 Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click Clipboard.SetDataObject(Texte.SelectedText) End Sub Private Sub ContextMenu1_Popup(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContextMenu1.Popup End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim a As New ColorDialog a.AnyColor = True 'permet d'apparaitre les couleurs de base seulment a.FullOpen = True 'pour aparaitre arc en ciel a.ShowHelp = True 'pour apparaitre l'icon d'aide a.Color = Texte.backcolor If a.ShowDialog = DialogResult.OK Then Texte.BackColor = a.Color End If End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim a As New FontDialog a.ShowApply = True 'pour apparaitre le boton de "appliquer" a.ShowColor = True 'permet d'apparaitre "couleur" ds un textbox a.ShowEffects = True 'a.AllowVerticalFonts = True a.Font = Texte.SelectionFont a.Color = Texte.SelectionColor If (a.ShowDialog() = DialogResult.OK) Then Texte.SelectionFont = a.Font Texte.SelectionColor = a.Color End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Texte.SelectionAlignment = HorizontalAlignment.Center End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Texte.SelectionAlignment = HorizontalAlignment.Left End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Texte.SelectionAlignment = HorizontalAlignment.Right End Sub Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click Texte.Cut() End Sub Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click Texte.Paste() End Sub Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click Texte.SelectAll() End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Dim a As MessageBox Dim b As MsgBoxResult b = a.Show("Voulez vous vraiment sortir????", "confirmation!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) If b = MsgBoxResult.Yes Then End End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp If e.Button = MouseButtons.Right Then Me.ContextMenu1.Show(Texte, New Point(e.X, e.Y)) End If End Sub End Class |