Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EnregistrerToolStripMenuItem.Click '[se produit quand on clique sur "Enregistrer" dans le menu] ' Displays a SaveFileDialog so the user can save the Image ' assigned to Button2. Dim saveFileDialog1 As New SaveFileDialog() saveFileDialog1.Filter = "Bmp|*.bmp|Jpeg|*.jpg" saveFileDialog1.Title = "Enregistrer la courbe" saveFileDialog1.ShowDialog() ' If the file name is not an empty string open it for saving. If saveFileDialog1.FileName <> "" Then ' Saves the Image via a FileStream created by the OpenFile method. Dim fs As System.IO.FileStream = CType _ (saveFileDialog1.OpenFile(), System.IO.FileStream) ' Saves the Image in the appropriate ImageFormat based upon the ' file type selected in the dialog box. ' NOTE that the FilterIndex property is one-based. Select Case saveFileDialog1.FilterIndex Case 1 Me.Chart1.SaveImage(fs, _ System.Drawing.Imaging.ImageFormat.Bmp) Case 2 Me.Chart1.SaveImage(fs, _ System.Drawing.Imaging.ImageFormat.Jpeg) End Select fs.Close() End If