PC Review


Reply
Thread Tools Rate Thread

BMP file included as a resource

 
 
Scott Meddows
Guest
Posts: n/a
 
      6th Oct 2003
I've added a BMP file to my project file in Visual Studio and told the
compiler to embed the file into the binary. How do I now read this file
back into a filestream?

Thanks


 
Reply With Quote
 
 
 
 
Justin Weinberg
Guest
Posts: n/a
 
      6th Oct 2003
Created with my new tool. Look at the ImageFromEmbedded method below.

'GDIPlus Architect Component Class Output
Public Class Untitled1
Inherits System.ComponentModel.Component

Private Image1Rectangle As System.Drawing.RectangleF = New
System.Drawing.RectangleF(41, 84, 338, 410)

Protected Image1 As System.Drawing.Bitmap

Public Sub New()
MyBase.New
Me.InitializeGraphics
End Sub

Private Sub InitializeGraphics()
Me.Image1 = Me.ImageFromEmbedded("MynameSpace.akeef.jpg")
End Sub

Public Overridable Sub RenderGraphics(ByVal g As
System.Drawing.Graphics)
g.DrawImage(Me.Image1, Me.Image1Rectangle)
End Sub

'Required to dispose of created resources
Private Sub DisposeGraphics()
Me.Image1.Dispose
End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
Me.DisposeGraphics
End If
End Sub

Private Function ImageFromEmbedded(ByVal embeddedPath As String) As
System.Drawing.Bitmap
Dim imageStream As System.IO.Stream =
System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(em
beddedPath)
Dim img As System.Drawing.Bitmap = New
System.Drawing.Bitmap(imageStream)
Return img
End Function
End Class


"Scott Meddows" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've added a BMP file to my project file in Visual Studio and told the
> compiler to embed the file into the binary. How do I now read this file
> back into a filestream?
>
> Thanks
>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      6th Oct 2003
"Scott Meddows" <(E-Mail Removed)> scripsit:
> I've added a BMP file to my project file in Visual Studio and told the
> compiler to embed the file into the binary. How do I now read this file
> back into a filestream?


<http://www.google.de/groups?selm=uhBexmVhDHA.2516%40TK2MSFTNGP09.phx.gbl>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
Tom Spink
Guest
Posts: n/a
 
      6th Oct 2003
Hi Scott,

Imports System.IO
Imports System.Reflection
..
..
..
Dim strmImage As Stream =
[Assembly].GetExecutingAssembly.GetManifestResourceStream("RootNamespace.Fil
e.bmp")

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations


"Scott Meddows" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've added a BMP file to my project file in Visual Studio and told the
> compiler to embed the file into the binary. How do I now read this file
> back into a filestream?
>
> Thanks
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
difference between local resource and project resource file =?Utf-8?B?Y2xhcmE=?= Microsoft VB .NET 1 30th Oct 2010 09:08 PM
Disposing strings created from a resource file using resource mana =?Utf-8?B?TXVydGh5?= Microsoft Dot NET Compact Framework 3 25th Jun 2007 03:30 PM
How Do I Update Meeting Series When Resource is Included =?Utf-8?B?T3NjYXIgVHJldmlubw==?= Microsoft Outlook Calendar 0 7th Apr 2006 07:55 PM
Failed to load resource from resource file. Plese check up your setup Andry Microsoft Dot NET Framework 0 22nd Nov 2005 07:52 AM
can I call getString() to get a string from a separate resource file instead of embedded resource? babylon Microsoft Dot NET Framework 2 7th Oct 2003 04:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:52 PM.