Custom Control with embedded graphic

Discussion in 'ASP .Net Building Controls' started by Dave Birchok via .NET 247, May 6, 2004.

  1. I am developing a custom control for web forms using VS 2003. Iam putting the control in a custom control library project whichwill become a dll. This control uses a small bitmap. I don'twnat to have to copy the graphic file into each web project thatwill use this custom control. VS allows you to set the graphicfile's build action property to embedded resource. When thecustom control renders it will create HTML that I would like toreference the embedded graphic file. Is this possible?

    Thanks,
    --------------------------------
    From: Dave Birchok

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>xTOeF9pKkUuQTsbjdTXLGQ==</Id>
    Dave Birchok via .NET 247, May 6, 2004
    #1
    1. Advertising

  2. Hi Dave,

    Yes its possible. The most common approach is to write a handler to serve
    embedded images from assemblies. ASP.NET's next version will have built-in
    support for this. You can take a look at this article[1] which contains
    enough info and detail about how it works and so it should serve as a
    jumpstart for your own implementation in ASP.NET 1.x

    [1]
    http://msdn.microsoft.com/asp.net/c...ll=/library/en-us/dnaspp/html/webresource.asp

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

    "Dave Birchok via .NET 247" <> wrote in message
    news:...
    I am developing a custom control for web forms using VS 2003. I am putting
    the control in a custom control library project which will become a dll.
    This control uses a small bitmap. I don't wnat to have to copy the graphic
    file into each web project that will use this custom control. VS allows you
    to set the graphic file's build action property to embedded resource. When
    the custom control renders it will create HTML that I would like to
    reference the embedded graphic file. Is this possible?

    Thanks,
    --------------------------------
    From: Dave Birchok

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>xTOeF9pKkUuQTsbjdTXLGQ==</Id>
    Victor Garcia Aprea [MVP], May 7, 2004
    #2
    1. Advertising

  3. Here is one way of retrieving embedded resource.
    I don't know though how you can apply it to image. But I think that
    this is possible.

    ' Retrieving XML-file from the embedded resources.
    Dim thisExe As System.Reflection.Assembly
    thisExe = System.Reflection.Assembly.GetExecutingAssembly()
    ' Replace "AssemblyName.FileName.xml" with the name of the
    resource, as it is known in the assembly.
    ' Use the GetManifestResourceNames method of the Assembly
    object to find the resource name.
    Dim strFileName As System.IO.Stream = _
    thisExe.GetManifestResourceStream("<Type Accembly Name
    Here>.Reports.xml")
    ' Read XML.
    Dim doc As XmlDocument = New XmlDocument()
    doc.Load(strFileName)


    WBR,
    Andrei
    Andrei Sinelnikov, May 7, 2004
    #3
  4. I have a complete code for this if you would like... The last remaining part
    of this is how do I use the embedded graphics at design-time? I know I could
    create a custom designer for this, but is there any other way?

    Fred

    "Dave Birchok via .NET 247" <> wrote in message
    news:...
    I am developing a custom control for web forms using VS 2003. I am putting
    the control in a custom control library project which will become a dll.
    This control uses a small bitmap. I don't wnat to have to copy the graphic
    file into each web project that will use this custom control. VS allows you
    to set the graphic file's build action property to embedded resource. When
    the custom control renders it will create HTML that I would like to
    reference the embedded graphic file. Is this possible?

    Thanks,
    --------------------------------
    From: Dave Birchok

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>xTOeF9pKkUuQTsbjdTXLGQ==</Id>
    Fred Hirschfeld, May 9, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Colin Paul Gloster
    Replies:
    48
    Views:
    1,853
    Colin Paul Gloster
    Apr 10, 2007
  2. 50 SOMETHING GAL
    Replies:
    3
    Views:
    392
  3. Matt Sokol
    Replies:
    2
    Views:
    367
    Theo Tillotson
    Aug 7, 2003
  4. Thomas Ekegren

    Page Load fired 3 times Web user control is embedded in a custom control

    Thomas Ekegren, Sep 3, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    216
    Thomas Ekegren
    Sep 3, 2003
  5. Thomas Dodds

    Databind an embedded control in an embedded datagrid

    Thomas Dodds, Jul 26, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    386
    Thomas Dodds
    Jul 26, 2004
Loading...

Share This Page