bonjour, j'ai créer ce logiciel pour copier des icon des exécutable.Mais voila , quand je copie icon la couleur n'ai pas belle, comment peut -t-il corriger mon probleme de couleur de l'extraction icon?
voici en image:
voici mes codes:
Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
Dim bm As New Bitmap(PictureBox1.Image)
Dim ico As Icon = Icon.FromHandle(bm.GetHicon)
Dim fs As New System.IO.FileStream(".ico", IO.FileMode.CreateNew)
ico.Save(fs)
fs.Close()
MsgBox("L'icone à bien été copier !", MsgBoxStyle.OkOnly, "Réussi!")
TextBox1.Clear()
TextBox2.Clear()
Label2.Text = Nothing
PictureBox1.Image = Nothing
End Sub
maintenant, je voudrais aussi afficher la label4.texte la taille du fichier.
voici mes codes:
dim lire As String
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim OpenFileDialog1 As New OpenFileDialog()
OpenFileDialog1.Filter = "All Files (*.*)|*.*"
If DialogResult.OK = OpenFileDialog1.ShowDialog Then
TextBox1.Text = OpenFileDialog1.FileName
Label2.Text = Path.GetFileName(OpenFileDialog1.FileName)
PictureBox1.Image = Icon.ExtractAssociatedIcon(TextBox1.Text).ToBitmap
End If
End Sub
Private Sub valeur(ByVal Taille As String)
If Taille < 1024 Then
lire = Taille & " Octets"
ElseIf Taille >= 1024 And Taille < 1048576 Then
lire = ((Taille / 1024) & 2) & " Ko"
ElseIf Taille >= 1048576 And Taille < 1073741824 Then
lire = ((Taille / 1048576) & 2) & " Mo"
ElseIf Taille >= 1073741824 And Taille < 1099511627776 Then
lire = ((Taille / 1073741824) & 2) & " Go"
End If
End Sub
comment peut ton corriger mes 2 probleme?
Merci,cordialement.
Dim bm As New Bitmap(PictureBox1.Image)
Dim ico As Icon = Icon.FromHandle(bm.GetHicon)
Dim fs As New System.IO.FileStream(copier & ".ico", IO.FileMode.CreateNew)
ico.Save(fs)
fs.Close()
MsgBox("L'icone à bien été copier !", MsgBoxStyle.OkOnly, "Réussi!")
...etc
voici mes codes modifier:
Dim bm As New Bitmap(PictureBox1.Image)
Dim fs As New System.IO.FileStream(copier & ".ico", IO.FileMode.CreateNew)
bm.Save(fs, System.Drawing.Imaging.ImageFormat.Icon)
fs.Close()
MsgBox("L'icone à bien été copier !", MsgBoxStyle.OkOnly, "Réussi!")
TextBox1.Clear()
TextBox2.Clear()
Label2.Text = Nothing
PictureBox1.Image = Nothing
j'ai encore une autre solution 3 :
system.io.file.copy(textbox1.text, textbox2.text)
mais avec la solution3, il me donne l'image impeccable mais au niveau de sa taille , il y a un probleme, il copy meme taille du fichier exe.
comment pourais extraire l'image sens avoir la taille du fichier exe.
les anciens code ,il me donne chromes.ico l'image n'est pas net.
les codes modifier , il copie mais il m'affiche pas l'image . mais 'il m'affiche comme une erreur (la valeur ne peut pas être nulle)
comment pourrais faire pas avoir l'image ico impeccable en copient.
Merci ,cordialement.