|
-
Apr 14th, 2014, 12:06 PM
#1
Thread Starter
Member
Convert Image to a VALID icon
I need help converting an image to a valid icon.
I can save the image as an Icon, no problem. BUT, when I try to use this Icon for it's intended purpose (just as either a project icon, or shortcut icon) .. an error appears telling me it is not a valid icon.
Code:
Dim bmp As New Bitmap(Path & shortLabel & "\" & imgName)
bmp.Save(Path & shortLabel & "\newIco.ico", System.Drawing.Imaging.ImageFormat.Icon)
Any solutions? Ideally without needing extra DLLs that would have to be included with my project, but if that's what it requires then so be it.
Thanks for your time.
-
Apr 14th, 2014, 12:11 PM
#2
Re: Convert Image to a VALID icon
What is the line where you are trying to use it?
More important than the will to succeed, is the will to prepare for success.
Please rate the posts, your comments are the fuel to keep helping people
-
Apr 14th, 2014, 12:15 PM
#3
Thread Starter
Member
Re: Convert Image to a VALID icon
No line, but manual.
So once this program has ran and created the said Icon, I'm going into a different project in VS, and setting the projects icon within the project properties screen.
-
Apr 14th, 2014, 12:33 PM
#4
Re: Convert Image to a VALID icon
try something like
Code:
Dim xxx As New Bitmap(Path & shortLabel & "\" & imgName)
Using ico As Icon = Icon.FromHandle(xxx.GetHicon())
Using icoFile As System.IO.FileStream = New System.IO.FileStream(Path & shortLabel & "\newIco.ico", System.IO.FileMode.OpenOrCreate)
ico.Save(icoFile)
End Using
End Using
More important than the will to succeed, is the will to prepare for success.
Please rate the posts, your comments are the fuel to keep helping people
-
Apr 14th, 2014, 12:34 PM
#5
Re: Convert Image to a VALID icon
or use Imports System.IO and simplify the code
Code:
Dim bmp As New Bitmap(Path & shortLabel & "\" & imgName)
Using ico As Icon = Icon.FromHandle(bmp.GetHicon())
Using icoFile As FileStream = New FileStream(Path & shortLabel & "\newIco.ico", FileMode.OpenOrCreate)
ico.Save(icoFile)
End Using
End Using
More important than the will to succeed, is the will to prepare for success.
Please rate the posts, your comments are the fuel to keep helping people
-
Apr 14th, 2014, 01:17 PM
#6
Thread Starter
Member
Re: Convert Image to a VALID icon
Still doesn't work... I can't figure out why, I've been trying various methods I've found laying around on the internet.... I'm puzzled!
-
Apr 14th, 2014, 01:28 PM
#7
Thread Starter
Member
Re: Convert Image to a VALID icon
I may of found a work around using an external application and command line.... Thank's for your help kaliman79912, I'll look further into my problem when I have time.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|