473,322 Members | 1,259 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,322 software developers and data experts.

Referencing an embedded icon, convert to image?

I have an icon that I can reference by the following:

Dim im As System.Drawing.Image
im = im.FromFile(lsapppath & "ChkMrk.ico")
g_mainform.fg.SetCellImage(g_mainform.FG.Row, 5, im)
The problem is that I do NOT want to reference this as "from file" - the icon is already
embedded in the program, but I can't seem to find a way to convert my embedded icon
to an image.

Any help appreciated. TIA.

Nov 20 '05 #1
8 3965
You can get embedded objects through the resource reader. See info on ResourceReader

"news.microsoft.com" <no*****@nothanks.com> wrote in message news:OE**************@TK2MSFTNGP10.phx.gbl...
I have an icon that I can reference by the following:

Dim im As System.Drawing.Image
im = im.FromFile(lsapppath & "ChkMrk.ico")
g_mainform.fg.SetCellImage(g_mainform.FG.Row, 5, im)
The problem is that I do NOT want to reference this as "from file" - the icon is already
embedded in the program, but I can't seem to find a way to convert my embedded icon
to an image.

Any help appreciated. TIA.

Nov 20 '05 #2
You can get embedded objects through the resource reader. See info on ResourceReader

"news.microsoft.com" <no*****@nothanks.com> wrote in message news:OE**************@TK2MSFTNGP10.phx.gbl...
I have an icon that I can reference by the following:

Dim im As System.Drawing.Image
im = im.FromFile(lsapppath & "ChkMrk.ico")
g_mainform.fg.SetCellImage(g_mainform.FG.Row, 5, im)
The problem is that I do NOT want to reference this as "from file" - the icon is already
embedded in the program, but I can't seem to find a way to convert my embedded icon
to an image.

Any help appreciated. TIA.

Nov 20 '05 #3
CJ --

Um, well, thanks, but that still doesn't help me. A real-life example would be appreciated.
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message news:Oi**************@TK2MSFTNGP10.phx.gbl...
You can get embedded objects through the resource reader. See info on ResourceReader

"news.microsoft.com" <no*****@nothanks.com> wrote in message news:OE**************@TK2MSFTNGP10.phx.gbl...
I have an icon that I can reference by the following:

Dim im As System.Drawing.Image
im = im.FromFile(lsapppath & "ChkMrk.ico")
g_mainform.fg.SetCellImage(g_mainform.FG.Row, 5, im)
The problem is that I do NOT want to reference this as "from file" - the icon is already
embedded in the program, but I can't seem to find a way to convert my embedded icon
to an image.

Any help appreciated. TIA.

Nov 20 '05 #4
CJ --

Um, well, thanks, but that still doesn't help me. A real-life example would be appreciated.
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message news:Oi**************@TK2MSFTNGP10.phx.gbl...
You can get embedded objects through the resource reader. See info on ResourceReader

"news.microsoft.com" <no*****@nothanks.com> wrote in message news:OE**************@TK2MSFTNGP10.phx.gbl...
I have an icon that I can reference by the following:

Dim im As System.Drawing.Image
im = im.FromFile(lsapppath & "ChkMrk.ico")
g_mainform.fg.SetCellImage(g_mainform.FG.Row, 5, im)
The problem is that I do NOT want to reference this as "from file" - the icon is already
embedded in the program, but I can't seem to find a way to convert my embedded icon
to an image.

Any help appreciated. TIA.

Nov 20 '05 #5
>Um, well, thanks, but that still doesn't help me. A real-life example would
be appreciated.

Dim myIcon As Icon = New System.Drawing.Icon(Me.GetType,
"MyEmbeddedIcon.ico")
Dim myBitmap As Bitmap = Bitmap.FromHicon(myIcon.Handle)

Erik
Nov 20 '05 #6
>Um, well, thanks, but that still doesn't help me. A real-life example would
be appreciated.

Dim myIcon As Icon = New System.Drawing.Icon(Me.GetType,
"MyEmbeddedIcon.ico")
Dim myBitmap As Bitmap = Bitmap.FromHicon(myIcon.Handle)

Erik
Nov 20 '05 #7
* "Erik Frey" <er*******@hotmail.com> scripsit:
Um, well, thanks, but that still doesn't help me. A real-life example would

be appreciated.

Dim myIcon As Icon = New System.Drawing.Icon(Me.GetType,
"MyEmbeddedIcon.ico")
Dim myBitmap As Bitmap = Bitmap.FromHicon(myIcon.Handle)


Alternatively it may be the preferred way to store a bitmap instead of
the icon...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #8
* "Erik Frey" <er*******@hotmail.com> scripsit:
Um, well, thanks, but that still doesn't help me. A real-life example would

be appreciated.

Dim myIcon As Icon = New System.Drawing.Icon(Me.GetType,
"MyEmbeddedIcon.ico")
Dim myBitmap As Bitmap = Bitmap.FromHicon(myIcon.Handle)


Alternatively it may be the preferred way to store a bitmap instead of
the icon...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #9

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

Similar topics

5
by: [Yosi] | last post by:
I have a form , I want to change form icon relate to some states, I all image list witch include some icons. How can I convert image to Icon or how to change the form icon ....in run time
4
by: Arda Coskun | last post by:
Hi, How to create embedded graphics and audios? Any article would be helpful. Kind regards,
3
by: Stanley | last post by:
I wish to set Form.Icon from an image list but seems like the image list didn't provide a method to extract the image as an Icon type. Thus, can anyone show me a way the conversion From:...
8
by: Wayne Hoover | last post by:
I have an embedded icon resource in my project - I need to reference this icon for a grid cell. I've tried using the following but it does not work. Any help appreciated: Dim im As...
8
by: news.microsoft.com | last post by:
I have an icon that I can reference by the following: Dim im As System.Drawing.Image im = im.FromFile(lsapppath & "ChkMrk.ico") g_mainform.fg.SetCellImage(g_mainform.FG.Row, 5, im) The problem...
11
by: Garrett | last post by:
I'm fairly new to VB .NET and programming in general, and I want to give my program its own icon without it being a separate file. I have the icon as part of the project, and its Build Action is...
6
by: Udi | last post by:
Hi, I have an imagelist initialized in design time with several icons files (.ico). However, when I need to extract an icon (Image) from the Imagelist, I can't convert it back to an icon: ...
1
by: =?Utf-8?B?U3RldmVU?= | last post by:
I have a structure that contains both 32x32 and 16x16 icons plus some text. I want to write all this to an XML file so that I can recover the icons later in an application. Can someone tell me how...
4
by: Marcolino | last post by:
Hi, I have simple needs but I don't know how to implement it. I have application that create Dynamic Button. I need to set the image on this button, getting the icon from a form. So pratically...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.