Afficher une image a partir d'une imagelist

Bonjour,
J'ai une imagelist, et a partir de cette imageliste j'aimerai afficher certaine image
Comment faire ? avec une picturebox ? listview ?
Merci d'avance ?
Configuration: Windows Vista
Firefox 3.0.13

11 réponses

  1. Modérateur
    il n'y a pas autre chose que Bitmap ?
    1
    1. Modérateur
      salut

      quel langage ?
      0
      1. Désoler de ne l'avoir pas préciser c'est du VB.Net
        0
        1. Pour l'instant j'ai ca

          PictureBox1.Image = photosjoueurs.Images(10)

          Ca affiche bien quelquechose mais en tout petit alors que la taille de la picture box est quand meme consequente
          0
          1. Modérateur
            salut

            essaye de travailler avec cet exemple, adapte le

            Private MyImage As Bitmap
            
            Public Sub ShowMyImage(fileToDisplay As String, xSize As Integer, _
                                   ySize As Integer)
                ' Sets up an image object to be displayed.
                If (MyImage IsNot Nothing) Then
                    MyImage.Dispose()
                End If
            
                ' Stretches the image to fit the pictureBox. 
                pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
                MyImage = New Bitmap(fileToDisplay)
                pictureBox1.ClientSize = New Size(xSize, ySize)
                pictureBox1.Image = CType(MyImage, Image)
            End Sub
            
            
            0
            1. Merci l'image s'affiche ^^ , maintenant j'ai un autre problème c'est que l'image est très très flou, alors qu'a la base sur mes .jpg ils sont en bonne qualité =S
              0
              1. Modérateur
                montre un peu ton code, svp
                0
                1. Public Class Form1
                  Private MyImage As Bitmap
                  Dim nbalea As Integer
                  Dim rep As String

                  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

                  End Sub

                  Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click

                  Randomize()

                  If (MyImage IsNot Nothing) Then
                  MyImage.Dispose()
                  End If

                  Randomize()

                  nbalea = Rnd() * 16

                  PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
                  MyImage = New Bitmap(photosjoueurs.Images(nbalea))
                  PictureBox1.Image = CType(MyImage, Image)

                  If nbalea = 0 Then
                  rep = "Beckenbauer"
                  End If
                  If nbalea = 1 Then
                  rep = "Cantona"
                  End If
                  If nbalea = 2 Then
                  rep = "Cruyff"
                  End If
                  If nbalea = 3 Then
                  rep = "Deschamps"
                  End If
                  If nbalea = 4 Then
                  rep = "Fontaine"
                  End If
                  If nbalea = 5 Then
                  rep = "Kopa"
                  End If
                  If nbalea = 6 Then
                  rep = "Maradona"
                  End If
                  If nbalea = 7 Then
                  rep = "Pelé"
                  End If
                  If nbalea = 8 Then
                  rep = "Platini"
                  End If
                  If nbalea = 9 Then
                  rep = "Rivaldo"
                  End If
                  If nbalea = 10 Then
                  rep = "Roberto carlos"
                  End If
                  If nbalea = 11 Then
                  rep = "Romario"
                  End If
                  If nbalea = 12 Then
                  rep = "Ronaldo"
                  End If
                  If nbalea = 13 Then
                  rep = "Tigana"
                  End If
                  If nbalea = 14 Then
                  rep = "Van Basten"
                  End If
                  If nbalea = 15 Then
                  rep = "Zico"
                  End If
                  If nbalea = 16 Then
                  rep = "Zidane"
                  End If

                  If reponse.Text = rep Then
                  MsgBox("Bien jouer !")

                  nbalea = Rnd() * 16

                  PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
                  MyImage = New Bitmap(photosjoueurs.Images(nbalea))
                  PictureBox1.Image = CType(MyImage, Image)

                  Else
                  MsgBox("retente ta chance")
                  End If
                  End Sub
                  End Class

                  Y a des bug que j'ai pas encore corriger mais ca je vais essayer de me debrouiller seul lol
                  C'est les images flou qui m'embette
                  0
                  1. Je ne sais pas c'est l'une des premiere fois ou je manipule des images
                    0
                    1. Modérateur
                      revoie peut être ton sizemode
                      0
                      1. Nan bah j'ai tout essayer, tjr aussi flou, tanpis lol
                        0