Referencing an embedded icon, convert to image?

  • Thread starter news.microsoft.com
  • Start date
N

news.microsoft.com

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.
 
C

CJ Taylor

You can get embedded objects through the resource reader. See info on ResourceReader

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.
 
N

news.microsoft.com

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 You can get embedded objects through the resource reader. See info on ResourceReader

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.
 
E

Erik Frey

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
 
H

Herfried K. Wagner [MVP]

* "Erik Frey said:
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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Embedded icon file - how to reference? 5
"embedded icon resource" ? 1
VB code help 3
icon for UserControl 4
Saving an image as an .ico file 3
Icon Chalange 2
Convert Image to Icon 3
Application Icon 7

Top