Embedded Resource (PNG) in DLL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Murphy via DotNetMonster.com

    #1

    Embedded Resource (PNG) in DLL

    Hi all, I've been strugling with this for the last few days and I'm wonding
    if any of you have had the same problem or a solution I could consider: I'm
    embedding a bitmap resource (PNG format) as part of an extended panel control
    that I'm creating. I'm trying read the embedded resource and draw it out on
    the panel. The drawing part I know how to do well enough, but for some reason
    when I try to access the embedded resource (PNG = "header_image.p ng") it
    always returns an empty stream (using helper methods wrapping
    GetManifestReso urce...). I'm stumped. Please help!


    --
    Message posted via http://www.dotnetmonster.com
  • Brian Henry

    #2
    Re: Embedded Resource (PNG) in DLL

    do you have the root namespace before the resource name? example
    MyRootNamespace .picture.png


    "Chris Murphy via DotNetMonster.c om" <forum@nospam.D otNetMonster.co m> wrote
    in message news:50326D4DC3 050@DotNetMonst er.com...[color=blue]
    > Hi all, I've been strugling with this for the last few days and I'm
    > wonding
    > if any of you have had the same problem or a solution I could consider:
    > I'm
    > embedding a bitmap resource (PNG format) as part of an extended panel
    > control
    > that I'm creating. I'm trying read the embedded resource and draw it out
    > on
    > the panel. The drawing part I know how to do well enough, but for some
    > reason
    > when I try to access the embedded resource (PNG = "header_image.p ng") it
    > always returns an empty stream (using helper methods wrapping
    > GetManifestReso urce...). I'm stumped. Please help!
    >
    >
    > --
    > Message posted via http://www.dotnetmonster.com[/color]


    Comment

    • Chris Murphy via DotNetMonster.com

      #3
      Re: Embedded Resource (PNG) in DLL

      I have some methods that take care of that

      Private AppAssembly As Reflection.Asse mbly = Reflection.Asse mbly.
      GetExecutingAss embly()
      Private AppAssemblyPath As String = Me.AppAssembly. GetName().Name( ).
      Replace(" ", "_")

      Private Function GetResource(ByV al FileName As String) As System.IO.
      Stream
      Try
      Return Me.AppAssembly. GetManifestReso urceStream(Me.
      AppAssemblyPath & "." & FileName)
      Catch ex As Exception
      MessageBox.Show ("Error returning resource: " & ex.ToString(),
      "XiNK!", MessageBoxButto ns.OK, MessageBoxIcon. Error)
      Return Nothing
      End Try
      End Function

      Brian Henry wrote:[color=blue]
      >do you have the root namespace before the resource name? example
      >MyRootNamespac e.picture.png
      >[color=green]
      >> Hi all, I've been strugling with this for the last few days and I'm
      >> wonding[/color]
      >[quoted text clipped - 9 lines][color=green]
      >> always returns an empty stream (using helper methods wrapping
      >> GetManifestReso urce...). I'm stumped. Please help![/color][/color]


      --
      Message posted via DotNetMonster.c om
      Best online pokies for real money in Australia and learn about safety and game mechanics in this comprehensive guide.

      Comment

      Working...