Private Sub selection_Click() showphoto End Sub Private Sub showphoto() Dim ext As String If OpenFile() = True Then Me.check.Enabled = True ext = Right(cmd.FileName, 3) If (ext <> "bmp" And ext <> "BMP") And (ext <> "JPG" And ext <> "jpg") And (ext <> "ico" And ext <> "ICO") And (ext <> "GIF" And ext <> "gif") Then MsgBox "photo seulement" Exit Sub End If Me.photo.Picture = LoadPicture(cmd.FileName) Me.photo.Appearance = 0 Me.photo.AutoRedraw = True Me.photo.AutoSize = True Me.photo.BorderStyle = 0 Me.photo.Top = Me.Height / 2 - (Me.photo.Height / 2) Me.photo.Left = Me.Width / 2 - Me.photo.Width / 2 Me.photo.Visible = True End If End Sub
Dim path As String Dim nfile As Integer Private Sub showphoto() Dim ext As String If OpenFile() = True Then Me.check.Enabled = True ext = Right(cmd.FileName, 3) If (ext <> "bmp" And ext <> "BMP") And (ext <> "JPG" And ext <> "jpg") And (ext <> "ico" And ext <> "ICO") And (ext <> "GIF" And ext <> "gif") Then MsgBox "photo seulement" Exit Sub End If path = cmd.FileName Me.photo.Picture = LoadPicture(cmd.FileName) Me.photo.Appearance = 0 Me.photo.AutoRedraw = True Me.photo.AutoSize = True Me.photo.BorderStyle = 0 Me.photo.Top = Me.Height / 2 - (Me.photo.Height / 2) Me.photo.Left = Me.Width / 2 - Me.photo.Width / 2 Me.photo.Visible = True End If End Sub Private Function OpenFile() As Boolean nfile = FreeFile Me.cmd.Filter = "Bitmap Files (*.bmp)|*.bmp|(*.JPG)|*.JPG|(*.GIF)|*.GIF|" Me.cmd.ShowOpen If cmd.FileName = "" Then OpenFile = False Me.check.Visible = False Exit Function End If Me.check.Visible = True Open cmd.FileName For Input As #nfile OpenFile = True End Function Private Sub selection_Click() showphoto End Sub Private Sub enregister_Click() Me.cmd.ShowSave Me.cmd.Filter = "Bitmap Files (*.bmp)|*.bmp|(*.JPG)|*.JPG|(*.GIF)|*.GIF|" Me.cmd.ShowSave FileCopy path, Me.cmd.FileName End Sub