473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Save BitMap as Icon

I give up...I have tried all combinations that I can think of and I can't get
a bitmap converted to an icon and save it in a filestream or stream;

Any help would be appreciated.
--
Dennis in Houston
Nov 21 '05 #1
5 2863
Hi,

Dim bm As New Bitmap("C:\Camera.bmp")

Dim ico As Icon = Icon.FromHandle(bm.GetHicon)

Dim fs As New System.IO.FileStream("C:\Camera.ico", IO.FileMode.CreateNew)

ico.Save(fs)

fs.Close()

Ken

-------------------------------

"Dennis" <De****@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
I give up...I have tried all combinations that I can think of and I can't
get
a bitmap converted to an icon and save it in a filestream or stream;

Any help would be appreciated.
--
Dennis in Houston
Nov 21 '05 #2
"Dennis" <De****@discussions.microsoft.com> schrieb:
I give up...I have tried all combinations that I can think
of and I can't get a bitmap converted to an icon and
save it in a filestream or stream;


<URL:http://vbaccelerator.com/article.asp?id=4567>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #3
Ken,

Looks great can this be seen as your code, because I have put it in a
snippet with your name.

Cor
Nov 21 '05 #4
Thanks a lot..I've been working on this for 2 days now. I wonder why this
doesn't work?

Dim fmt As ImageFormat
fmt = ImageFormat.Icon
im2.Save("c:\icon1.ico", fmt)

It give an error that value cannot be null, Parameter Encoder.

"Ken Tucker [MVP]" wrote:
Hi,

Dim bm As New Bitmap("C:\Camera.bmp")

Dim ico As Icon = Icon.FromHandle(bm.GetHicon)

Dim fs As New System.IO.FileStream("C:\Camera.ico", IO.FileMode.CreateNew)

ico.Save(fs)

fs.Close()

Ken

-------------------------------

"Dennis" <De****@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
I give up...I have tried all combinations that I can think of and I can't
get
a bitmap converted to an icon and save it in a filestream or stream;

Any help would be appreciated.
--
Dennis in Houston

Nov 21 '05 #5
Hi,

Dim bm As New Bitmap("c:\camera.bmp")

bm.Save("C:\Camera.ico", Imaging.ImageFormat.Icon)

Ken

---------------------------------------

"Dennis" <De****@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Thanks a lot..I've been working on this for 2 days now. I wonder why this
doesn't work?

Dim fmt As ImageFormat
fmt = ImageFormat.Icon
im2.Save("c:\icon1.ico", fmt)

It give an error that value cannot be null, Parameter Encoder.

"Ken Tucker [MVP]" wrote:
Hi,

Dim bm As New Bitmap("C:\Camera.bmp")

Dim ico As Icon = Icon.FromHandle(bm.GetHicon)

Dim fs As New System.IO.FileStream("C:\Camera.ico", IO.FileMode.CreateNew)

ico.Save(fs)

fs.Close()

Ken

-------------------------------

"Dennis" <De****@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
I give up...I have tried all combinations that I can think of and I can't
get
a bitmap converted to an icon and save it in a filestream or stream;

Any help would be appreciated.
--
Dennis in Houston

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: BC | last post by:
Hello, We are creating an Office add-in. We are able to display the add-in successfully. However, we followed a sample program, and it displays a FaceID = 1044 (which is not the bitmap of the...
2
by: Carl Gilbert | last post by:
Hi I have to following code which sets up a new bitmap. 'set up a transparent 16x16 bitmap Dim bm As New Bitmap(16, 16) Dim g As Graphics = Graphics.FromImage(bm)...
2
by: Dennis | last post by:
I have created a bitmap and set the transparency color to black; mybitmap.MakeTransparent(Color.Black) myicon = Icon.FromHandle(bm.GetHicon) This creates the icon ok but the background color...
2
by: jaumef_2000 | last post by:
Hello, I'm developing a Standard Windows App and I need to deal with Icons. I've read lots of posts about them and I'm missing something. I put this code in a button click in a new brand new...
2
by: Dennis | last post by:
I have about 50 images in my application as "embedded resources". They are Icon size (16x16 and 24x24 and 32x32). I can use either the bitmap version or convert them to Icons. Either way seems...
3
by: SveinErik | last post by:
Hi, I'm trying to find a method to save bmp, jpg and png files as ico files, 16x16 size. I have managed to convert and save bmp files to icon, but only in 32x32 size. I can't figure out how to save...
4
by: Frank | last post by:
Private Sub SaveBitmap(ByVal fileName As String, ByVal p As System.Drawing.Bitmap) ...snip p.Save(fileName, Imaging.ImageFormat.Icon) Does not produce an icon formatted file. At least if I...
2
by: Smokey Grindel | last post by:
when I do this code Dim HIcon As IntPtr = bmp.GetHicon to convert a Bitmap which is just a 16x16 image I pulled from a resource originally as an icon (16x16x32bit) then converted into a bitmap to...
0
Computer Guru
by: Computer Guru | last post by:
On Error Resume Next Dim SaveFileDialog As New SaveFileDialog SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.