IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Redimensionner une image


Sujet :

VB.NET

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2015
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2015
    Messages : 3
    Points : 1
    Points
    1
    Par défaut Redimensionner une image
    Bonjour,

    Je suis en train de faire un petit programme pour enregistrer des fiches d'informations avec une image et du texte. Il y a un formulaire ou je choisis mon image sur le pc et des champs pour rentrer mon texte. Toutes mes infos sont sérialisées dans un fichier en binaire. J'enregistre puis ma fiche s'affiche dans une listbox. Si je clique sur un item de la liste les données sont désérialisées vers une zone d'aperçu où mon texte s'affiche ainsi que l'image sauf que l'image est trop grande je n'ai qu'une partie d'affiche dans la picturebox même en choisissant la valeur stretch pour le sizemode.
    D'après ce que j'ai pu lire il faut que je redimensionne mon image grâce à un bitmap.

    Voici mes codes :


    Tout d'abord ma classe :



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
     
    <Serializable()>
    Public Class Fiche
     
     
     
     
        Private Property _ImageFiche As Bitmap
        Public Property ImageFiche As Bitmap
            Get
                Return _ImageFiche
            End Get
            Set(ByVal value As Bitmap)
                _ImageFiche = value
            End Set
        End Property
     
        Private _GenreEspece As String
        Public Property GenreEspece As String
            Get
                Return _GenreEspece
            End Get
            Set(ByVal value As String)
                _GenreEspece = value
            End Set
        End Property
     
        Private _DateReception As Date
        Public Property DateReception As Date
            Get
                Return _DateReception
            End Get
            Set(ByVal value As Date)
                _DateReception = value
            End Set
        End Property
     
        Private _Localite As String
        Public Property Localite As String
            Get
                Return _Localite
            End Get
            Set(ByVal value As String)
                _Localite = value
            End Set
        End Property
     
        Private _Source As String
        Public Property Source As String
            Get
                Return _Source
            End Get
            Set(ByVal value As String)
                _Source = value
            End Set
        End Property
     
     
     
        Private _CouleurFleur As String
        Public Property CouleurFleur As String
            Get
                Return _CouleurFleur
            End Get
            Set(ByVal value As String)
                _CouleurFleur = value
            End Set
        End Property
     
        Private _Note As String
        Public Property Note As String
            Get
                Return _Note
            End Get
            Set(ByVal value As String)
                _Note = value
            End Set
        End Property
     
        Private _NbExemplaire As Integer
        Public Property NbExemplaire As Integer
            Get
                Return _NbExemplaire
            End Get
            Set(ByVal value As Integer)
                _NbExemplaire = value
            End Set
        End Property
     
        Private _Condition As String
        Public Property Condition As String
            Get
                Return _Condition
            End Get
            Set(ByVal value As String)
                _Condition = value
            End Set
        End Property
     
     
        Public Sub New()
     
        End Sub
     
        Public Sub New(ByVal ImageFiche As Bitmap, ByVal Condition As String, ByVal GenreEspece As String, ByVal DateReception As Date, ByVal Localite As String, ByVal Source As String, ByVal CouleurFleur As String, ByVal Note As String, ByVal NbExemplaire As Integer)
            _GenreEspece = GenreEspece
            _DateReception = DateReception
            _Localite = Localite
            _Source = Source
            _CouleurFleur = CouleurFleur
            _Note = Note
            _NbExemplaire = NbExemplaire
            _Condition = Condition
            _ImageFiche = ImageFiche
        End Sub
     
     
        Public Sub Update(ByVal ImageFiche As Bitmap, ByVal Condition As String, ByVal GenreEspece As String, ByVal DateReception As Date, ByVal Localite As String, ByVal Source As String, ByVal CouleurFleur As String, ByVal Note As String, ByVal NbExemplaire As Integer)
            _GenreEspece = GenreEspece
            _DateReception = DateReception
            _Localite = Localite
            _Source = Source
            _CouleurFleur = CouleurFleur
            _Note = Note
            _NbExemplaire = NbExemplaire
            _Condition = Condition
            _ImageFiche = ImageFiche
        End Sub
     
        'Je surcharge le Tostring
        Public Overrides Function ToString() As String
            Return _GenreEspece
        End Function
     
    End Class

    La fenêtre formulaire où je rentre mes données qui sont sérialisées :

    Nom : datawindows.png
Affichages : 207
Taille : 86,7 Ko

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    78
    79
    80
    81
    82
    83
    84
     
     
    Imports System.Runtime.Serialization.Formatters.Binary
    Imports System.IO
     
    <Serializable()>
    Public Class Fiche_Plante
     
        Private _FicheAModifier As Fiche
     
        Sub New(ByVal FicheAModifier As Fiche)
     
            ' Cet appel est requis par le concepteur.
            InitializeComponent()
     
            ' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
     
            'Récupère la fiche à modifier
            _FicheAModifier = FicheAModifier
     
        End Sub
     
        Private Sub AjoutEditionFiche_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     
            If _FicheAModifier Is Nothing Then
                'S'il ne contient rien, on en crée un nouveau
            Else
                'Sinon on recupère les infos et on les entre dans les cases correspondantes
                Me.IMG_AFFICHE.Image = _FicheAModifier.ImageFiche
                Me.FICHE_COLOR.Text = _FicheAModifier.CouleurFleur
                Me.FICHE_GENRE_ESPECE.Text = _FicheAModifier.GenreEspece
                Me.FICHE_NOTE.Text = _FicheAModifier.Note
                Me.FICHE_SOURCE.Text = _FicheAModifier.Source
                Me.FICHE_LOCALITE.Text = _FicheAModifier.Localite
                Me.NB_EXEMPLAIRE.Value = _FicheAModifier.NbExemplaire
                Me.FICHE_DATE.Value = _FicheAModifier.DateReception
                Me.FICHE_CONDITION.Text = _FicheAModifier.Condition
            End If
     
        End Sub
     
        Private Sub BT_SAVE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_SAVE.Click
     
            'On controle par des conditions que le genre et l'espèce ont été renseigné pour enregistrer la fiche sinon on affiche une msg box
            If IsNothing(FICHE_GENRE_ESPECE.Text) Or FICHE_GENRE_ESPECE.Text = "" Then
                MsgBox("Veuillez rentrer au moins le nom de la plante")
            Else
     
                If _FicheAModifier Is Nothing Then
                    'Enregistre la fiche
                    Dim MaFiche As New Fiche(Me.IMG_AFFICHE.Image, Me.FICHE_CONDITION.Text, Me.FICHE_GENRE_ESPECE.Text, Me.FICHE_DATE.Value, Me.FICHE_LOCALITE.Text, Me.FICHE_SOURCE.Text, Me.FICHE_COLOR.Text, Me.FICHE_NOTE.Text, Me.NB_EXEMPLAIRE.Value)
                    'On l'ajoute à la liste
                    Index_Carnivore_21_12_14.ListeFiches.Add(MaFiche)
                    MsgBox("Fiche correctement créée", vbOKOnly, "Confirmation")
                Else
                    'Sinon on le modifie en récupérant son index dans la liste de la fenêtre parent
                    Index_Carnivore_21_12_14.ListeFiches(Index_Carnivore_21_12_14.ListeFiches.IndexOf(_FicheAModifier)).Update(Me.IMG_AFFICHE.Image, Me.FICHE_CONDITION.Text, Me.FICHE_GENRE_ESPECE.Text, Me.FICHE_DATE.Value, Me.FICHE_LOCALITE.Text, Me.FICHE_SOURCE.Text, Me.FICHE_COLOR.Text, Me.FICHE_NOTE.Text, Me.NB_EXEMPLAIRE.Value)
                End If
     
                'MAJ de la liste dans la fenêtre parent
                Index_Carnivore_21_12_14.UpdateListe()
     
                'Ferme la fenêtre d'édition
                Me.Close()
            End If
     
     
        End Sub
     
     
     
     
     
     
     
        Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
                IMG_AFFICHE.ImageLocation = OpenFileDialog1.FileName
            End If
        End Sub
     
     
     
    End Class
    Et ma fenêtre principale où je peux choisir dans ma listbox d'afficher l'aperçu de mes données, créer de nouvelles fiches ou en supprimer :

    Nom : mainwindows.png
Affichages : 197
Taille : 86,6 Ko

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    Imports System.Runtime.Serialization.Formatters.Binary
    Imports System.IO
     
    <Serializable()>
    Public Class Index_Carnivore_21_12_14
     
        Private _FenetreAjout As Fiche_Plante
        Private _FicheEnVisualisation As Fiche
        Private _ListeFiches As List(Of Fiche)
     
     
     
     
     
        Public Property ListeFiches As List(Of Fiche)
            Get
                Return _ListeFiches
            End Get
            Set(ByVal value As List(Of Fiche))
                _ListeFiches = value
            End Set
        End Property
     
     
        Private Sub ListeFiches_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     
            'Instancie une nouvelle liste
            _ListeFiches = New List(Of Fiche)
     
            'Récupère les infos
            Deserialisation()
     
            'MAJ la liste de films
            UpdateListe()
     
        End Sub
     
        Private Sub ListeFiches_FormClosing(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.FormClosing
            'Sérialise les fiches lors de la fermeture
            Serialisation()
        End Sub
     
        Private Sub LB_LISTE_FICHES_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SEARCH_LISTE_PLANTES.SelectedIndexChanged
     
            SEARCH_LISTE_PLANTES.Sorted = True
     
            'On vérifie qu'on a sélectionné quelque chose
            If Not Me.SEARCH_LISTE_PLANTES.SelectedItem Is Nothing Then
                'Retrouve la fiche avec ce nom
                For Each FicheALister As Fiche In _ListeFiches
                    If FicheALister.GenreEspece = SEARCH_LISTE_PLANTES.SelectedItem.ToString Then
                        'L'insère dans une variable globale
                        Me._FicheEnVisualisation = FicheALister
                    End If
                Next
     
                'On MAJ les infos de la fiche
     
                Me.INDEX_GENRE_ESPECE.Text = Me._FicheEnVisualisation.GenreEspece
                Me.INDEX_DATE.Text = Me._FicheEnVisualisation.DateReception.ToShortDateString 'La date seule
                Me.INDEX_SOURCE.Text = Me._FicheEnVisualisation.Source
                Me.INDEX_LOCALITE.Text = Me._FicheEnVisualisation.Localite
                Me.INDEX_COLOR.Text = Me._FicheEnVisualisation.CouleurFleur
                Me.INDEX_NOTE.Text = Me._FicheEnVisualisation.Note
                Me.INDEX_EXEMPLAIRE.Text = Me._FicheEnVisualisation.NbExemplaire
                Me.INDEX_CONDITION.Text = Me._FicheEnVisualisation.Condition
                Me.INDEX_IMG.BackgroundImage = Me._FicheEnVisualisation.ImageFiche
     
            End If
     
     
        End Sub
     
        Public Sub UpdateListe()
            'On vide la liste et on la reremplit
            Me.SEARCH_LISTE_PLANTES.Items.Clear()
            'Parcourt les films de la bibliothèque
            For Each FicheALister As Fiche In _ListeFiches
                'Remplit la liste en se basant sur le nom (vu que j'ai surchargé ToString)
                'A le même effet que FicheALister.GenreEspece sans la surcharge.
                Me.SEARCH_LISTE_PLANTES.Items.Add(FicheALister)
            Next
        End Sub
     
    #Region "Boutons modif fiche"
     
        Private Sub BT_SUPPRIMER_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_SUPPRIMER.Click
     
            'Confirmation
            If MsgBox("Etes vous certain de vouloir supprimer cette fiche ?", vbYesNo, "Confirmation") Then
                'On le retire de la liste
                Me._ListeFiches.Remove(_FicheEnVisualisation)
            End If
     
            'MAJ
            UpdateListe()
     
        End Sub
     
        Private Sub BT_NOUVELLE_FICHE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_NOUVELLE_FICHE.Click
            'Si nouveau film, on passe nothing
            _FenetreAjout = New Fiche_Plante(Nothing)
            _FenetreAjout.Show()
        End Sub
     
        Private Sub BT_MAJ_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_MAJ.Click
            'Si une MAJ, on passe le paramètre du film actuel
            _FenetreAjout = New Fiche_Plante(_FicheEnVisualisation)
            _FenetreAjout.Show()
        End Sub
     
    #End Region
     
    #Region "Sauvegarde et récupération"
     
     
     
        Private Sub Deserialisation()
            If File.Exists("BibliothequeFiches.bin") Then
                'On ouvre le fichier et récupère son flux
                Dim FluxDeFichier As FileStream = File.OpenRead("BibliothequeFiches.bin")
                Dim Deserialiseur As New BinaryFormatter()
                'Désérialisation et conversion de ce qu'on récupère dans le type « Fiche »
                _ListeFiches = Deserialiseur.Deserialize(FluxDeFichier)
                'Fermeture du flux
                FluxDeFichier.Close()
            End If
        End Sub
     
        Private Sub Serialisation()
            'On crée le fichier et récupère son flux
            Dim FluxDeFichier As FileStream = File.Create("BibliothequeFiches.bin")
            Dim Serialiseur As New BinaryFormatter()
            'Sérialisation et écriture
            Serialiseur.Serialize(FluxDeFichier, _ListeFiches)
            'Fermeture du fichier
            FluxDeFichier.Close()
        End Sub
     
     
     
    #End Region
     
    #Region "Section recherche"
     
        Private Sub RemplissageChampsRecherche()
            'Fonction utilisée plus tard pour préremplir les DDL de genres, réalisateurs…
        End Sub
     
        Private Sub BT_RECHERCHE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_RECHERCHE.Click
            Recherche()
        End Sub
     
        Private Sub BT_EFFACER_RECHERCHE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_EFFACER_RECHERCHE.Click
            Me.SEARCH_GENRE.Text = ""
            Me.SEARCH_CONDITION.Text = ""
            Me.SEARCH_COLOR.Text = ""
            Me.SEARCH_DATE.Text = ""
            Me.SEARCH_SOURCE.Text = ""
            Me.SEARCH_LOCALITE.Text = ""
            UpdateListe()
        End Sub
     
        Private Sub Recherche()
     
            'On vide la liste et on la reremplit
            Me.SEARCH_LISTE_PLANTES.Items.Clear()
            'Parcourt les films de la bibliothèque
            For Each FicheALister As Fiche In _ListeFiches
     
                If Me.SEARCH_GENRE.Text <> "" Then
                    If FicheALister.GenreEspece.Contains(Me.SEARCH_GENRE.Text) Then
                        Me.SEARCH_LISTE_PLANTES.Items.Add(FicheALister)
                    End If
                End If
     
     
                If Me.SEARCH_COLOR.Text <> "" Then
                    If FicheALister.CouleurFleur.Contains(Me.SEARCH_COLOR.Text) Then
                        Me.SEARCH_LISTE_PLANTES.Items.Add(FicheALister)
                    End If
                End If
     
                If Me.SEARCH_DATE.Text <> "" Then
                    If CDate(FicheALister.DateReception).Year = Me.SEARCH_DATE.Text Then
                        Me.SEARCH_LISTE_PLANTES.Items.Add(FicheALister)
                    Else
                        MsgBox("Veuillez ne rentrer que la date année de réception")
     
     
                    End If
     
                End If
     
                If Me.SEARCH_SOURCE.Text <> "" Then
                    If FicheALister.Source.Contains(Me.SEARCH_SOURCE.Text) Then
                        Me.SEARCH_LISTE_PLANTES.Items.Add(FicheALister)
                    End If
                End If
     
                If Me.SEARCH_LOCALITE.Text <> "" Then
                    If FicheALister.Localite.Contains(Me.SEARCH_LOCALITE.Text) Then
                        Me.SEARCH_LISTE_PLANTES.Items.Add(FicheALister)
                    End If
                End If
                If Me.SEARCH_CONDITION.Text <> "" Then
                    If FicheALister.Condition.Contains(Me.SEARCH_CONDITION.Text) Then
                        Me.SEARCH_LISTE_PLANTES.Items.Add(FicheALister)
     
                    End If
                End If
     
            Next
     
        End Sub
     
    #End Region
     
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     
     
     
     
            Liste_culture.Show()
        End Sub
     
     
     
     
        Private Sub QuitterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitterToolStripMenuItem.Click
            'Sérialise les fiches lors de la fermeture
            Serialisation()
            End
        End Sub
     
        Private Sub AfficherLaideToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AfficherLaideToolStripMenuItem.Click
            Aide.Show()
        End Sub
     
     
    End Class

    Donc voilà, j'ai bien compris que pour avoir mon image redimensionner il faut que je l'enregistre sous un bitmap que j'aurais redimensionné puis afficher ce nouveau bitmap dans ma picturebox. Sauf que je ne sais pas du tout par quel bout le prendre.

    Cordialement
    Erlin

  2. #2
    Membre éprouvé

    Homme Profil pro
    Inscrit en
    Mars 2012
    Messages
    691
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Israël

    Informations forums :
    Inscription : Mars 2012
    Messages : 691
    Points : 929
    Points
    929
    Par défaut
    Bonjour

    peut être ainsi


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     Dim photo As New Bitmap(_FicheAModifier.ImageFiche.Width \ 2,_FicheAModifier.ImageFiche.Height \ 2)
                Dim dr = System.Drawing.Graphics.FromImage(photo)
                dr.DrawImage(My.Resources.exitlogo_fw, 0, 0, FicheAModifier.ImageFiche.Width \ 2, _FicheAModifier.ImageFiche.Height \ 2)
                 Me.IMG_AFFICHE.Image = photo

  3. #3
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2015
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2015
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    Bonsoir,

    Merci d'avoir pris le temps de réfléchir à une solution. Pouvez vous m'éclairer sur votre solution ? J'ai essayé d'intégrer ce morceau de code à différents endroits mais il y a une erreur à ce niveau : "My.Resources.exitlogo_fw"

    "exitlogo_fw" doit être une déclaration dans un de vos code car en cherchant sur internet je suis tombé sur ce lien:http://www.developpez.net/forums/d14...fenetre-timer/

    Pouvez vous m'expliquer par quelle déclaration je dois le remplacer ?

  4. #4
    Membre éprouvé

    Homme Profil pro
    Inscrit en
    Mars 2012
    Messages
    691
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Israël

    Informations forums :
    Inscription : Mars 2012
    Messages : 691
    Points : 929
    Points
    929
    Par défaut
    ah erreur de ma part

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     Dim photo As New Bitmap(_FicheAModifier.ImageFiche.Width \ 2,_FicheAModifier.ImageFiche.Height \ 2)
                Dim dr = System.Drawing.Graphics.FromImage(photo)
                dr.DrawImage(_FicheAModifier.ImageFiche, 0, 0, FicheAModifier.ImageFiche.Width \ 2, _FicheAModifier.ImageFiche.Height \ 2)
                 Me.IMG_AFFICHE.Image = photo

  5. #5
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2015
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2015
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    Bonjour,

    J'ai essayé de le faire avec cette cette méthode mais ça n'a pas fonctionné. Par contre j'ai dû changer quelque chose ou alors je n'avais pas bien essayé la première fois mais maintenant en choisissant la valeur "zoom" l'image est bien redimensionné du moins juste son affichage. Mais ça ne change pas la taille d'origine à voir si ça risque de ralentir mon programme.

    Un petit aperçu de ce que ça donne :

    Nom : ic.jpg
Affichages : 189
Taille : 218,3 Ko

    J'ai rajouté une option pour changer le backgroundimage

Discussions similaires

  1. [VB.NET] Redimensionner une image dans un PictureBox
    Par Monster77 dans le forum Windows Forms
    Réponses: 6
    Dernier message: 05/04/2007, 19h24
  2. [32 bits] Redimensionner une image JPEG/GIF/PNG...
    Par CR_Gio dans le forum x86 32-bits / 64-bits
    Réponses: 2
    Dernier message: 04/10/2005, 01h57
  3. Redimensionner une image...
    Par RhaZieL dans le forum VB 6 et antérieur
    Réponses: 12
    Dernier message: 22/07/2005, 10h30
  4. [VB.NET] Redimensionner une image proportionnelement
    Par Monster77 dans le forum Windows Forms
    Réponses: 3
    Dernier message: 19/10/2004, 13h10
  5. [MX2004] redimensionner une image lors du chargement
    Par ouinouin dans le forum Flash
    Réponses: 8
    Dernier message: 18/02/2004, 19h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo